✅ Supports multi-platforms (x86_64, arm64)
This Dockerfile builds a cli where you can run terraform, aws cli, and go commands. Pass in the following required environment variables:
- AWS_SECRET_ACCESS_KEY
- AWS_ACCESS_KEY_ID
- AWS_DEFAULT_REGION
Author: Lim Chooi Guan (AWS Architect, AWS Certified Solutions Architect)
- Docker
- AWS account
aws-shell
, run aws commands with auto-complete! See herecfn-dia
, diagramming tool to visualise Cloudformation templates! See hereaws
, the AWS CLIterraform
terratest_log_parser
go
-
Clone this repo.
-
Open up a terminal window to this directory and run:
docker build -t local/terraform-aws-go-cli:latest .
-
Open up a terminal to your terraform module folder, now run the container using the new image:
docker run --env AWS_SECRET_ACCESS_KEY="h2gmFakeh6Jrv8nQOGpCSa+Ary5" --env AWS_ACCESS_KEY_ID="AFAKEF7TR4654HFVXX" --env AWS_DEFAULT_REGION="eu-west-1" --rm --name terraform-aws-go-cli -v $(pwd):/workspace -it local/terraform-aws-go-cli bash
-
If you're using aws-vault, you can export the env variables as follows:
docker run --env-file <(aws-vault exec YOUR_AWS_VAULT_PROFILE_HERE -- env | grep ^AWS_) --rm --name terraform-aws-go-cli -v $(pwd):/workspace -it local/terraform-aws-go-cli bash
-
In the container, test that your credentials work and other installed software works by running:
aws s3 ls go version terraform -v
-
(Optional) To build specific platform versions, and push to your own Dockerhub registry, run:
`docker buildx build --platform linux/amd64,linux/arm64 -t YOUR_DOCKERHUB_ID/terraform-aws-go-cli:latest --push .`
-
Done! Have a coffee! ☕️