Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Last active September 22, 2018 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlainODea/c950a02ad5a3253e8728f9207af5fc0b to your computer and use it in GitHub Desktop.
Save AlainODea/c950a02ad5a3253e8728f9207af5fc0b to your computer and use it in GitHub Desktop.
Terraform: Latest Ubuntu 16.04 LTS encrypted AMI
resource "aws_ami_copy" "ubuntu-16_04-encrypted" {
name = "${data.aws_ami.ubuntu-16_04.name}-encrypted"
description = "${data.aws_ami.ubuntu-16_04.description} (encrypted)"
source_ami_id = "${data.aws_ami.ubuntu-16_04.id}"
source_ami_region = "${var.region}"
encrypted = true
tags {
ImageType = "encrypted-ubuntu-16_04"
}
}
data "aws_ami" "ubuntu-16_04" {
most_recent = true
owners = ["${var.ubuntu_account_number}"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
}
}
variable "ubuntu_account_number" {
default = "099720109477"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment