Skip to content

Instantly share code, notes, and snippets.

@mijdavis2
Created November 14, 2018 22:27
Show Gist options
  • Save mijdavis2/f29697b4fd3592edcd68f936514be775 to your computer and use it in GitHub Desktop.
Save mijdavis2/f29697b4fd3592edcd68f936514be775 to your computer and use it in GitHub Desktop.
# Gets latest aws linux ami published by amazon
# Example use with an optional var:
# ${upper(var.ami) == "NONE" ? data.aws_ami.default.id : var.ami}
data "aws_ami" "default" {
most_recent = true
filter {
name = "name"
values = ["amzn-ami-*-x86_64-gp2"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "owner-alias"
values = ["amazon"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment