So I tried to use the tag instead of the tags block so I can do a dynamic block with other fixed tags.
However, it looks like {{ .SourceAMI }} would return no value:
dynamic "tag" {
for_each = merge(
var.my__other_tags,
{
Name = "${var.ami_name} {{ isotime \"2006-01-02-15-04\" }}",
source-ami = "{{ .SourceAMI }}"
}
)
content {
key = tag.key
value = tag.value
}
}
From the packer logs:
==> amazon-ebs.amzn2: Creating AMI tags
amazon-ebs.amzn2: Adding tag: "Name": "Amazon Linux 2 AMI 2020-10-20-16-48"
amazon-ebs.amzn2: Adding tag: "source-ami": "<no value>"
...
I’m using the latest Packer v1.6.4. Any ideas what I did wrong here?