hashicorp / hashicorp/packer-plugin-amazon
The copied image does not have name if error occurs
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
_This issue was originally opened by @EugenKon in https://github.com/hashicorp/packer/issues/13100 and has been migrated to this repository. The original issue description is below._
---
#### Overview of the Issue

The copied image does not have name if this error occurs: https://github.com/hashicorp/packer/issues/13099
The image is not tagged also.
#### Reproduction Steps
See config at the linked issue.
### Expected behaviour
The name and Tags should be assigned as possible as image was created. Otherwise it is not clear what this image is. It could be created a lot of images with empty names and this is ambiguous.
Here image is ready and must be named/tagged:

### Actual behaviour
But it is tagged a far later:

### Relevant log messages
```
==> amazon-ebs.nomad_ami: Stopping the source instance...
amazon-ebs.nomad_ami: Stopping instance
==> amazon-ebs.nomad_ami: Waiting for the instance to stop...
==> amazon-ebs.nomad_ami: Creating AMI -nomad-20240704171233 from instance i-0e4XX
amazon-ebs.nomad_ami: AMI: ami-06365XX
==> amazon-ebs.nomad_ami: Waiting for AMI to become ready...
==> amazon-ebs.nomad_ami: Copying/Encrypting AMI (ami-063658XX) to other regions...
amazon-ebs.nomad_ami: Copying to: ca-central-1
amazon-ebs.nomad_ami: Copying to: us-east-1
amazon-ebs.nomad_ami: Copying to: us-east-2
amazon-ebs.nomad_ami: Copying to: us-west-1
amazon-ebs.nomad_ami: Waiting for all copies to complete...
==> amazon-ebs.nomad_ami: Skipping Enable AMI deprecation...
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-0383XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-00015eXXX
==> amazon-ebs.nomad_ami: Creating AMI tags
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18eXX"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Creating snapshot tags
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-06dc8XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-06481XX
==> amazon-ebs.nomad_ami: Creating AMI tags
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18XX"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
==> amazon-ebs.nomad_ami: Creating snapshot tags
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-0636XX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-00d7XX
==> amazon-ebs.nomad_ami: Creating AMI tags
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18XX"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
==> amazon-ebs.nomad_ami: Creating snapshot tags
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-03fbXXX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-0838XX
==> amazon-ebs.nomad_ami: Creating AMI tags
amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff18eXX"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Creating snapshot tags
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Adding tags to AMI (ami-03fcXX)...
==> amazon-ebs.nomad_ami: Tagging snapshot: snap-06077XX
==> amazon-ebs.nomad_ami: Creating AMI tags
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
amazon-ebs.nomad_ami: Adding tag: "OS_Version": "Ubuntu"
amazon-ebs.nomad_ami: Adding tag: "Release": "24.04 LTS"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_ID": "ami-0aff1XX"
amazon-ebs.nomad_ami: Adding tag: "Base_AMI_Name": "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20240701.1"
==> amazon-ebs.nomad_ami: Creating snapshot tags
amazon-ebs.nomad_ami: Adding tag: "Description": "Base image for EC2 instances on Nomad cluster"
amazon-ebs.nomad_ami: Adding tag: "Name": "-nomad"
==> amazon-ebs.nomad_ami: Terminating the source AWS instance...
==> amazon-ebs.nomad_ami: Cleaning up any extra volumes...
==> amazon-ebs.nomad_ami: No volumes to clean up, skipping
==> amazon-ebs.nomad_ami: Deleting temporary security group...
==> amazon-ebs.nomad_ami: Deleting temporary keypair...
Build 'amazon-ebs.nomad_ami' finished after 11 minutes 26 seconds.
==> Wait completed after 11 minutes 26 seconds
==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs.nomad_ami: AMIs were created:
ca-central-1: ami-06dc8XX
us-east-1: ami-03fb6XX
us-east-2: ami-03fcdXX
us-west-1: ami-0383a2XX
us-west-2: ami-06365XX
```
### Packer version
v1.9.4
Contributor guide
Assessment
This issue has not been assessed yet.