Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Last active August 22, 2022 14:17
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AlainODea/be4fd6fc53bfbbcad45a7a9989db6c4e to your computer and use it in GitHub Desktop.
Save AlainODea/be4fd6fc53bfbbcad45a7a9989db6c4e to your computer and use it in GitHub Desktop.
Terraform: Latest Ubuntu 18.04 LTS encrypted AMI
resource "aws_ami_copy" "ubuntu-18_04-encrypted" {
name = "${data.aws_ami.ubuntu-18_04.name}-encrypted"
description = "${data.aws_ami.ubuntu-18_04.description} (encrypted)"
source_ami_id = "${data.aws_ami.ubuntu-18_04.id}"
source_ami_region = "${var.region}"
encrypted = true
tags {
ImageType = "encrypted-ubuntu-18_04"
}
}
data "aws_ami" "ubuntu-18_04" {
most_recent = true
owners = ["${var.ubuntu_account_number}"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.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