hashicorp / hashicorp/packer-plugin-amazon

Packer does not copy AMI tags cross accounts

Open
#423 3 comments 14 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

#### 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

![image](https://github.com/hashicorp/packer-plugin-amazon/assets/96890067/9e82537f-cfb3-4fe3-83c9-111350a60dbe)

![image](https://github.com/hashicorp/packer-plugin-amazon/assets/96890067/ee3c6d3c-6828-4f5e-abe9-c6c30dc9abde)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.