packer-plugin-amazon
packer-plugin-amazon copied to clipboard
Packer does not copy AMI tags cross accounts
Overview of the Issue
I am building an AMI and copying it to another 3 regions and to another 3 accounts. The tags in the AMI are copied successfully along with the AMI to the another regions, but not the another accounts.
Reproduction Steps
Creates a new AMI with the following snippet
data "amazon-ami" "amazon_linux_2" {
access_key = "${var.aws_access_key}"
filters = {
name = "amzn2-ami-hvm-*-x86_64-gp2*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
}
Add the tags block:
tags = {
Name = "amazon-linux-${regex_replace(timestamp(), "[- TZ:]", "")}"
ansible = "true"
packer = "true"
cross-account = "true"
}
Copy the AMI to another regions, example:
ami_regions = ["us-east-1", "us-east-2", "us-west-2"]
Copy the AMI to another accounts, example:
ami_users = ["account_id_1", "account_id_2", "account_id_3"]
The AMI is created in the accounts account_id_1 in us-east-1, us-east-2, us-west-2 with the proper tags. The AMI is copied to account_id_2 and account_id_3 successfully, but the tags are not there.
Plugin and Packer version
Plugin: version = ">= 1.2.6" Packer: 1.9.2