/terraform-aws-cli

Minimal & lightweight docker image including AWS and Terraform CLI

Primary LanguageDockerfileApache License 2.0Apache-2.0

lint-build-test push-latest release

License Docker Pulls

Terraform and AWS CLI Docker image

📦 Supported tags and respective Dockerfile links

Available image tags can be found on the Docker Hub registry: zenika/terraform-aws-cli

The following image tag strategy is applied:

  • zenika/terraform-aws-cli:latest - build from master
    • Included CLI versions can be found in the Dockerfile
  • zenika/terraform-aws-cli:release-S.T_terraform-UU.VV.WW_awscli-XX.YY.ZZ - build from releases
    • release-S.T is the release tag
    • terraform-UU.VV.WWW is the Terraform version included in the image
    • awscli-XX.YY.ZZ is the AWS CLI version included in the image

Please report to the releases page for the changelogs. Any other tags are not supported.

💡 Motivation

The goal is to create a minimalist and lightweight image with these tools in order to reduce network and storage impact.

This image gives you the flexibility to be used for development or as a base image as you see fits.

🔧 What's inside ?

Tools included:

🚀 Usage

Launch the CLI

Set your AWS credentials (optional) and launch the container, for instance using the latest image:

echo AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
echo AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
echo AWS_DEFAULT_REGION=YOUR_DEFAULT_REGION

docker container run -it --rm -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" -v ${PWD}:/workspace zenika/terraform-aws-cli:latest

The --rm flag will completely destroy the container and its data on exit.

Build the image

You can build the image locally directly from the Dockerfiles, using the build script.

It will :

# launch build script
./dev-build.sh

Optionally, it is possible to choose the tools desired versions using Docker builds arguments:

Be aware that tests will fail and should be updated if you choose different CLI versions.

# Set tools desired versions
AWS_CLI_VERSION=1.18.93
TERRAFORM_VERSION=0.12.28

# launch the build script with parameters
./dev-build.sh $AWS_CLI_VERSION $TERRAFORM_VERSION

🙏 Contributions

Do not hesitate to contribute by filling an issue or a PR !

📖 License

This project is under the Apache License 2.0