hashicorp / hashicorp/packer-plugin-amazon

Error modify AMI attributes when importing AWS accounts via variables.auto.pkrvars.hcl leading zero's are dropped.

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
help wanted question stage/waiting-reply
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

_This issue was originally opened by @trevenen in https://github.com/hashicorp/packer/issues/11185 and has been migrated to this repository. The original issue description is below._

---
#### Overview of the Issue

"Error modify AMI attributes"

When importing AWS accounts via variables.auto.pkrvars.hcl leading zero's are dropped.
I am dynamically pulling a list of AWS accounts into a file.

The file looks like this (I am not including our AWS accounts.)
ami_users = ["0123...", "123...", "1234...", "02134"]

"Error modify AMI attributes: InvalidAMIAttributeItemValue: Invalid attribute item value "123... " for userId item type.
status code: 400, request id: e46......."

Notice the leading zero in the file, when the error states what it iterating over the leading zero is dropped and there is an added space at the end of the AWS account number.

#### Reproduction Steps
Use Packer version 1.7.3
Use variables.auto.pkrvars.hcl to bring in ~ 68 AWS accounts with ~ 10 with leading zero's when removed, packer does move through accounts without a leading zero just perfectly until it hits an other account with a leading zero.

packer fmt.
packer validate .
packer build .

enjoy "Error modify AMI attributes: InvalidAMIAttributeItemValue: Invalid attribute item value "123... " for userId item type.
status code: 400, request id: e46......."

### Simplified Packer Buildfile
[gist](https://gist.github.com/trevenen/3486e7a721991a0abfe584bd1a2bb0de)

### Operating system and Environment details

MacOS Catalina v 10.15.7, Architecture, and any other information you can provide about the
environment.

### Log Fragments and crash.log files
Everything works perfectly until
"Error modify AMI attributes: InvalidAMIAttributeItemValue: Invalid attribute item value "123... " for userId item type.
status code: 400, request id: e46......."

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.