Skip to content

Instantly share code, notes, and snippets.

@athiwatp
Forked from AlainODea/main.tf
Created February 6, 2020 11:58
Show Gist options
  • Save athiwatp/45663421fd48277933cf8392f074a521 to your computer and use it in GitHub Desktop.
Save athiwatp/45663421fd48277933cf8392f074a521 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