Skip to content

Instantly share code, notes, and snippets.

@marcaurele
Created April 8, 2022 11:39
Show Gist options
  • Save marcaurele/0594c5e1d38e605d84c77ba92fad5868 to your computer and use it in GitHub Desktop.
Save marcaurele/0594c5e1d38e605d84c77ba92fad5868 to your computer and use it in GitHub Desktop.
Run Terraform via docker using aws-vault to provide AWS variables

To run terraform via a container while providing the aws-vault env variables:

docker run --rm \
    -v `pwd`:/workspace \
    -w /workspace/terraform \
    --env-file <(aws-vault exec default -- env | grep AWS) \
    --env TF_WORKSPACE=production \
    hashicorp/terraform:1.1.6 \
    init/plan/apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment