我想将 AMI 名称添加到打包程序清单中。我了解如何获取 AMI id,但其名称有所不同。我有:
data "amazon-ami" "ubuntu" {
filters = {
name = "ubuntu-minimal/images/hvm-ssd/ubuntu-focal-20.04-amd64-minimal-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
region = "us-east-1"
}
source "amazon-ebs" "ui" {
ami_name = "my-ami-${formatdate("YYYY-MM-DD-hhmmss", timestamp())}"
instance_type = "t3.small"
region = "us-east-1"
source_ami = "${data.amazon-ami.ubuntu.id}"
ssh_pty = true
ssh_username = "ubuntu"
}
build {
sources = ["source.amazon-ebs.ui"]
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
version = "${source.ami_name}"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到的错误是Unsupported attribute; This …