AWS credentials not passing through to Vagrant box
:speaking_head: Foreword
Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
:ghost: Brief Description
When spinning up a new Vagrant box, the AWS credentials are not being properly passed to the Vagrant box resulting in errors such as the following when trying to access SSM parameters
Aws::Errors::MissingCredentialsError
------------------------------------
unable to sign request without credentials set
Version
kitchen-vagrant 1.13.0
Environment
Here are some specs about the overall environment:
- Workstation OS: Ubuntu 22.04
- Vagrant v2.3.4
- bento/amazonlinux-2 v1.3
Scenario
I'm trying to access AWS resources from within the Vagrant box and am unable to do so
Steps to Reproduce
Here is the configuration I'm using:
driver:
name: vagrant
env:
- AWS_REGION=<%= ENV['AWS_REGION'] %>
- AWS_ACCESS_KEY_ID=<%= ENV['AWS_ACCESS_KEY_ID'] %>
- AWS_SECRET_ACCESS_KEY=<%= ENV['AWS_SECRET_ACCESS_KEY'] %>
- AWS_SESSION_TOKEN=<%= ENV['AWS_SESSION_TOKEN'] %>
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: amazonlinux
driver:
box: bento/amazonlinux-2
I run the following command: bundle exec kitchen converge default-amazonlinux
Everything runs correctly, the box spins up and the Chef run begins and then I get the following error Error executing action get on resource 'aws_ssm_parameter_store along with the error already shared above.
Expected Result
A successful Chef run
Actual Result
Error executing action get on resource 'aws_ssm_parameter_store
Aws::Errors::MissingCredentialsError
------------------------------------
unable to sign request without credentials set
Thanks in advance for any help/guidance.
Btw, the same happens if I use aws-vault and remove the env block under driver. For example:
driver:
name: vagrant
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: amazonlinux
driver:
box: bento/amazonlinux-2