Last active
August 22, 2022 14:17
-
-
Save AlainODea/be4fd6fc53bfbbcad45a7a9989db6c4e to your computer and use it in GitHub Desktop.
Terraform: Latest Ubuntu 18.04 LTS encrypted AMI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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