Commit 75effc3f authored by Bryant Biggs's avatar Bryant Biggs Committed by GitHub

chore: update `README.md` example for making an encrypted AMI (#235)

parent e80ac14a
......@@ -64,38 +64,44 @@ This module does not support encrypted AMI's out of the box however it is easy e
This example creates an encrypted image from the latest ubuntu 16.04 base image.
```hcl
resource "aws_ami_copy" "ubuntu-xenial-encrypted-ami" {
name = "ubuntu-xenial-encrypted-ami"
description = "An encrypted root ami based off ${data.aws_ami.ubuntu-xenial.id}"
source_ami_id = "${data.aws_ami.ubuntu-xenial.id}"
source_ami_region = "eu-west-2"
encrypted = "true"
tags {
Name = "ubuntu-xenial-encrypted-ami"
}
provider "aws" {
region = "us-west-2"
}
data "aws_ami" "encrypted-ami" {
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["679593333241"]
filter {
name = "name"
values = ["ubuntu-xenial-encrypted"]
values = ["ubuntu-minimal/images/hvm-ssd/ubuntu-focal-20.04-*"]
}
owners = ["self"]
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
data "aws_ami" "ubuntu-xenial" {
resource "aws_ami_copy" "ubuntu_encrypted_ami" {
name = "ubuntu-encrypted-ami"
description = "An encrypted root ami based off ${data.aws_ami.ubuntu.id}"
source_ami_id = data.aws_ami.ubuntu.id
source_ami_region = "eu-west-2"
encrypted = true
tags = { Name = "ubuntu-encrypted-ami" }
}
data "aws_ami" "encrypted-ami" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
values = [aws_ami_copy.ubuntu_encrypted_ami.id]
}
owners = ["099720109477"]
owners = ["self"]
}
```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment