Skip to content

Instantly share code, notes, and snippets.

@lgallard
Created June 22, 2017 13:52
Show Gist options
  • Save lgallard/6f394791c76dadf990b5403b46d453c6 to your computer and use it in GitHub Desktop.
Save lgallard/6f394791c76dadf990b5403b46d453c6 to your computer and use it in GitHub Desktop.
A script to run Terraform using the hashicorp/terraform image container
#/bin/sh
`grep -A 2 "\[$1\]" $HOME/.aws/credentials | tail -n 2 | awk '{ print toupper($1)"="$3 }' | sed '/^AWS_/s/^/export /'`
docker run -it -v $PWD:/data -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --workdir=/data/$2 hashicorp/terraform:$3 $4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment