Hi all,
I was originally using packer v1.2.4 with our .json and everything was running fine. I wanted to update packer to a newer version and found out that after 1.4.2 I could no longer run my .json as-is like before. My issue is that my main account has forced MFA, so I was using 'aws-mfa' to setup the session/security token in ~/.aws/credentials, all I had in the build.json was the profile and it's "just worked" up until I upgraded. I've tried a lot of different things to no avail and I'm wondering if it's just not possible anymore or what changed in these later versions that would have broken my setup.
{
"variables": {
"access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
},
"builders": [{
"type": "amazon-ebs",
"profile": "packer-dev",
"access_key": "{{user `access_key`}}",
"secret_key": "{{user `secret_key`}}",
...
Here's the credentials for the profile:
[packer-dev]
aws_access_key_id = xxx
aws_secret_access_key = xxx
[packer-dev-long-term]
assumed_role = True
assumed_role_arn = arn:aws:iam::222:role/XXX
aws_access_key_id = xxx
aws_secret_access_key = xxx
aws_session_token = XXX
aws_security_token = XXX
expiration = <date>
role_arn = arn:aws:iam::111:role/XXX
The build would be executed via:
env AWS_PROFILE=packer-dev-long-term packer.1.2.4 build build.json
That's the gist of the original config, the access_key/secret_key were never really used and I don't think they were ever set as environment variables.
If I try to run the same command on v1.6.0 I get:
Build 'amazon-ebs' errored: AssumeRoleTokenProviderNotSetError: assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.
So I added mfa_code to variables/builders and passed it with the environment:
env AWS_PROFILE=packer-dev-long-term MFA_CODE=12345 packer.1.6.0 build build.json
When I run that I get an invalid subnet ID:
==> amazon-ebs: Describing the subnet: subnet-xxx returned error: InvalidSubnetID.NotFound: The subnet ID 'subnet-xxx' does not exist
The subnet clearly exists because this works fine on 1.4.2. I'm at a loss and I can continue to use 1.4.2 but I really want to know why this won't work anymore.
Please let me know if you need more information.
Thanks,
Kurt