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
Supported versions are listed in the supported_versions.json
file in project root folder.
The following image tag strategy is applied:
zenika/terraform-aws-cli:latest
- build from master- Included CLI versions are the newest in the
supported_versions.json
file.
- Included CLI versions are the newest in the
zenika/terraform-aws-cli:release-S.T_terraform-UU.VV.WW_awscli-XX.YY.ZZ
- build from releasesrelease-S.T
is the release tagterraform-UU.VV.WWW
is the Terraform version included in the imageawscli-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 even if available.
💡 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:
- Terraform CLI
- AWS CLI
- Git for Terraform remote module usage
- Python 3
- jq to process JSON returned by AWS
- This image uses a non-root user with a UID and GID of 1001 to conform with docker security best practices.
🚀 Usage
🐚 Launch the CLI
Set your AWS credentials (optional) and use the CLI as you would on any other platform, 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 :
- Lint the Dockerfile with Hadolint;
- Build and tag the image
zenika/terraform-aws-cli:dev
; - Execute container structure tests on the image.
# launch build script
./dev.sh
Optionally, it is possible to choose the tools desired versions :
# Set tools desired versions
AWS_CLI_VERSION=1.18.189
TERRAFORM_VERSION=0.14.0
# launch the build script with parameters
./dev.sh $AWS_CLI_VERSION $TERRAFORM_VERSION
🙏 Contributions
Do not hesitate to contribute by filling an issue or a PR !
⬆️ Dependencies upgrades checklist
- Supported versions:
- check available AWS CLI version on the project release page
- check available Terraform CLI version (keep all minor versions from 0.11) available on the project release page
- Dockerfile:
- check base image version on DockerHub
- check OS package versions on Debian package repository
- Available Git versions on the Debian Packages repository
- Available Python versions on the Debian packages repository
- Available JQ versions on the Debian Packages repository
- same process for all other packages
- check Pip package versions on pypi
- Github actions:
- check runner version
- check each action release versions
- Build scripts:
- check container tags:
- Readme:
- update version in code exemples
🚩 Similar repositories
- For Azure: zenika-open-source/terraform-azure-cli
📖 License
This project is under the Apache License 2.0