Skip to content

Instantly share code, notes, and snippets.

@petersellars
Last active April 3, 2019 11:20
Show Gist options
  • Save petersellars/d0ac8c19568dff44264682fd957efa19 to your computer and use it in GitHub Desktop.
Save petersellars/d0ac8c19568dff44264682fd957efa19 to your computer and use it in GitHub Desktop.
variable "region" {
default = "ap-southeast-2"
}
variable "version" {
default = "trusty-14.04"
}
variable "architecture" {
default = "amd64"
}
provider "aws" {
region = "${var.region}"
}
data "aws_ami" "ubuntu_trusty" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-${var.version}-${var.architecture}-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
output "ami_id" {
value = "${data.aws_ami.ubuntu_trusty.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment