Giter Site home page Giter Site logo

cytopia / docker-terragrunt Goto Github PK

View Code? Open in Web Editor NEW
41.0 3.0 11.0 167 KB

Alpine-based multistage-build version of Terragrunt and Terraform for reproducible usage in CI

License: MIT License

Dockerfile 21.66% Makefile 62.08% HCL 7.00% Shell 9.27%
alpine multistage multistage-docker docker dockerfile docker-image docker-container terragrunt terraform ci continuous-integration awesome-ci

docker-terragrunt's Introduction

Docker image for terragrunt

Tag License

lint build nightly

All #awesome-ci Docker images

ansible-lint ansible awesome-ci bandit black checkmake eslint file-lint gofmt goimports golint jsonlint kubeval linkcheck mypy php-cs-fixer phpcbf phpcs phplint pycodestyle pydocstyle pylint terraform-docs terragrunt-fmt terragrunt yamlfmt yamllint

View Dockerfiles on GitHub.

Available Architectures: amd64, i386, arm64

Tiny Alpine-based multistage-build dockerized version of Terragrunt[1] and its compatible version of Terraform[2].

🐳 Available Docker image versions

Docker

Rolling releaess

The following Docker image tags are rolling releases and are built and updated every night.

nightly

Docker Tag Git Ref Terraform Terragrunt Available Architectures
latest master latest latest amd64, i386, arm64
1.6-0.55 master 1.6.x 0.55.x amd64, i386, arm64
1.6-0.54 master 1.6.x 0.54.x amd64, i386, arm64
1.6-0.53 master 1.6.x 0.53.x amd64, i386, arm64
1.5-0.53 master 1.5.x 0.53.x amd64, i386, arm64
1.5-0.52 master 1.5.x 0.52.x amd64, i386, arm64
1.5-0.51 master 1.5.x 0.51.x amd64, i386, arm64
1.5-0.50 master 1.5.x 0.50.x amd64, i386, arm64
1.5-0.49 master 1.5.x 0.49.x amd64, i386, arm64
1.5-0.48 master 1.5.x 0.48.x amd64, i386, arm64
1.5-0.47 master 1.5.x 0.47.x amd64, i386, arm64
1.5-0.46 master 1.5.x 0.46.x amd64, i386, arm64
1.4-0.50 master 1.4.x 0.50.x amd64, i386, arm64
1.4-0.49 master 1.4.x 0.49.x amd64, i386, arm64
1.4-0.48 master 1.4.x 0.48.x amd64, i386, arm64
1.4-0.47 master 1.4.x 0.47.x amd64, i386, arm64
1.4-0.46 master 1.4.x 0.46.x amd64, i386, arm64
1.3-0.50 master 1.3.x 0.50.x amd64, i386, arm64
1.3-0.49 master 1.3.x 0.49.x amd64, i386, arm64
1.3-0.48 master 1.3.x 0.48.x amd64, i386, arm64
1.3-0.47 master 1.3.x 0.47.x amd64, i386, arm64
1.3-0.46 master 1.3.x 0.46.x amd64, i386, arm64
1.2-0.41 master 1.2.x 0.41.x amd64, i386, arm64
1.2-0.40 master 1.2.x 0.40.x amd64, i386, arm64
1.2-0.39 master 1.2.x 0.39.x amd64, i386, arm64
1.2-0.38 master 1.2.x 0.38.x amd64, i386, arm64
1.2-0.37 master 1.2.x 0.37.x amd64, i386, arm64
1.1-0.38 master 1.1.x 0.38.x amd64, i386, arm64
1.1-0.38 master 1.1.x 0.38.x amd64, i386, arm64
1.1-0.37 master 1.1.x 0.37.x amd64, i386, arm64
1.1-0.36 master 1.1.x 0.36.x amd64, i386, arm64
1.1-0.35 master 1.1.x 0.35.x amd64, i386, arm64
1.0-0.38 master 1.0.x 0.38.x amd64, i386, arm64
1.0-0.37 master 1.0.x 0.37.x amd64, i386, arm64
1.0-0.36 master 1.0.x 0.36.x amd64, i386, arm64
1.0-0.35 master 1.0.x 0.35.x amd64, i386, arm64
1.0-0.34 master 1.0.x 0.34.x amd64, i386, arm64
0.15-0.34 master 0.15.x 0.34.x amd64, i386, arm64
0.15-0.33 master 0.15.x 0.33.x amd64, i386, arm64
0.15-0.32 master 0.15.x 0.32.x amd64, i386, arm64
0.15-0.31 master 0.15.x 0.31.x amd64, i386, arm64
0.15-0.30 master 0.15.x 0.30.x amd64, i386, arm64
0.14-0.34 master 0.14.x 0.34.x amd64, i386, arm64
0.14-0.33 master 0.14.x 0.33.x amd64, i386, arm64
0.14-0.32 master 0.14.x 0.32.x amd64, i386, arm64
0.14-0.31 master 0.14.x 0.31.x amd64, i386, arm64
0.14-0.30 master 0.14.x 0.30.x amd64, i386, arm64
0.13-0.34 master 0.13.x 0.34.x amd64, i386, arm64
0.13-0.33 master 0.13.x 0.33.x amd64, i386, arm64
0.13-0.32 master 0.13.x 0.32.x amd64, i386, arm64
0.13-0.31 master 0.13.x 0.31.x amd64, i386, arm64
0.13-0.30 master 0.13.x 0.30.x amd64, i386, arm64
0.12-0.24 master 0.12.x 0.24.x amd64, i386
0.12-0.23 master 0.12.x 0.23.x amd64, i386
0.12-0.22 master 0.12.x 0.22.x amd64, i386
0.12-0.21 master 0.12.x 0.21.x amd64, i386
0.12-0.20 master 0.12.x 0.20.x amd64, i386
0.12-0.19 master 0.12.x 0.19.x amd64, i386
0.11-0.18 master 0.11.x 0.18.x amd64, i386

Point in time releases

The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.

build

Docker Tag Git Ref Terraform Terragrunt Available Architectures
latest-<tag> tag: <tag> latest latest amd64, i386, arm64
1.5-0.50-<tag> tag: <tag> 1.5.x 0.50.x amd64, i386, arm64
1.5-0.49-<tag> tag: <tag> 1.5.x 0.49.x amd64, i386, arm64
1.5-0.48-<tag> tag: <tag> 1.5.x 0.48.x amd64, i386, arm64
1.5-0.47-<tag> tag: <tag> 1.5.x 0.47.x amd64, i386, arm64
1.5-0.46-<tag> tag: <tag> 1.5.x 0.46.x amd64, i386, arm64
1.4-0.50-<tag> tag: <tag> 1.4.x 0.50.x amd64, i386, arm64
1.4-0.49-<tag> tag: <tag> 1.4.x 0.49.x amd64, i386, arm64
1.4-0.48-<tag> tag: <tag> 1.4.x 0.48.x amd64, i386, arm64
1.4-0.47-<tag> tag: <tag> 1.4.x 0.47.x amd64, i386, arm64
1.4-0.46-<tag> tag: <tag> 1.4.x 0.46.x amd64, i386, arm64
1.3-0.50-<tag> tag: <tag> 1.3.x 0.50.x amd64, i386, arm64
1.3-0.49-<tag> tag: <tag> 1.3.x 0.49.x amd64, i386, arm64
1.3-0.48-<tag> tag: <tag> 1.3.x 0.48.x amd64, i386, arm64
1.3-0.47-<tag> tag: <tag> 1.3.x 0.47.x amd64, i386, arm64
1.3-0.46-<tag> tag: <tag> 1.3.x 0.46.x amd64, i386, arm64
1.2-0.41-<tag> tag: <tag> 1.2.x 0.41.x amd64, i386, arm64
1.2-0.40-<tag> tag: <tag> 1.2.x 0.40.x amd64, i386, arm64
1.2-0.39-<tag> tag: <tag> 1.2.x 0.39.x amd64, i386, arm64
1.2-0.38-<tag> tag: <tag> 1.2.x 0.38.x amd64, i386, arm64
1.2-0.37-<tag> tag: <tag> 1.2.x 0.37.x amd64, i386, arm64
1.1-0.39-<tag> tag: <tag> 1.1.x 0.39.x amd64, i386, arm64
1.1-0.38-<tag> tag: <tag> 1.1.x 0.38.x amd64, i386, arm64
1.1-0.37-<tag> tag: <tag> 1.1.x 0.37.x amd64, i386, arm64
1.1-0.36-<tag> tag: <tag> 1.1.x 0.36.x amd64, i386, arm64
1.1-0.35-<tag> tag: <tag> 1.1.x 0.35.x amd64, i386, arm64
1.0-0.38-<tag> tag: <tag> 1.0.x 0.38.x amd64, i386, arm64
1.0-0.37-<tag> tag: <tag> 1.0.x 0.37.x amd64, i386, arm64
1.0-0.36-<tag> tag: <tag> 1.0.x 0.36.x amd64, i386, arm64
1.0-0.35-<tag> tag: <tag> 1.0.x 0.35.x amd64, i386, arm64
1.0-0.34-<tag> tag: <tag> 1.0.x 0.34.x amd64, i386, arm64
0.15-0.34-<tag> tag: <tag> 0.15.x 0.34.x amd64, i386, arm64
0.15-0.33-<tag> tag: <tag> 0.15.x 0.33.x amd64, i386, arm64
0.15-0.32-<tag> tag: <tag> 0.15.x 0.32.x amd64, i386, arm64
0.15-0.31-<tag> tag: <tag> 0.15.x 0.31.x amd64, i386, arm64
0.15-0.30-<tag> tag: <tag> 0.15.x 0.30.x amd64, i386, arm64
0.14-0.34-<tag> tag: <tag> 0.14.x 0.34.x amd64, i386, arm64
0.14-0.33-<tag> tag: <tag> 0.14.x 0.33.x amd64, i386, arm64
0.14-0.32-<tag> tag: <tag> 0.14.x 0.32.x amd64, i386, arm64
0.14-0.31-<tag> tag: <tag> 0.14.x 0.31.x amd64, i386, arm64
0.14-0.30-<tag> tag: <tag> 0.14.x 0.30.x amd64, i386, arm64
0.13-0.34-<tag> tag: <tag> 0.13.x 0.34.x amd64, i386, arm64
0.13-0.33-<tag> tag: <tag> 0.13.x 0.33.x amd64, i386, arm64
0.13-0.32-<tag> tag: <tag> 0.13.x 0.32.x amd64, i386, arm64
0.13-0.31-<tag> tag: <tag> 0.13.x 0.31.x amd64, i386, arm64
0.13-0.30-<tag> tag: <tag> 0.13.x 0.30.x amd64, i386, arm64
0.12-0.24-<tag> tag: <tag> 0.12.x 0.24.x amd64, i386
0.12-0.23-<tag> tag: <tag> 0.12.x 0.23.x amd64, i386
0.12-0.22-<tag> tag: <tag> 0.12.x 0.22.x amd64, i386
0.12-0.21-<tag> tag: <tag> 0.12.x 0.21.x amd64, i386
0.12-0.20-<tag> tag: <tag> 0.12.x 0.20.x amd64, i386
0.12-0.19-<tag> tag: <tag> 0.12.x 0.19.x amd64, i386
0.11-0.18-<tag> tag: <tag> 0.11.x 0.18.x amd64, i386

Where <tag> refers to the chosen git tag from this repository.

📂 Docker mounts

The working directory inside the Docker container is /data/ and should be mounted to your local filesystem where your Terragrant project resides. (See Examples for mount location usage.)

💻 Usage

docker run --rm -v $(pwd):/data cytopia/terragrunt terragrunt <ARGS>
docker run --rm -v $(pwd):/data cytopia/terragrunt terraform <ARGS>

🔠 Environment variables

The following environment variables will ease your life when mounting directories into the docker container by maintaining file system permissions.

Variables Default Description
RUN_NON_ROOT 0 Set to 1 to run commands as user instead of root.
UID 1000 Set to the uid of your local user (id -u) if you want to run as non root.
GID 1000 Set to the gid of your local user (id -g) if you want to run as non root.

ℹ️ Examples

1. Simple: Provision single sub-project on AWS

1.1 Project overview

Let's assume your Terragrunt project setup is as follows:

/my/tf                                              # Terragrunt project root
├── backend-app
│   ├── main.tf
│   └── terragrunt.hcl
├── frontend-app
│   ├── main.tf
│   └── terragrunt.hcl
├── mysql                                           # MySQL sub-project directory
│   ├── main.tf
│   └── terragrunt.hcl
├── redis
│   ├── main.tf
│   └── terragrunt.hcl
└── vpc
    ├── main.tf
    └── terragrunt.hcl

The MySQL sub-project you want to provision is at the releative path mysql/.

1.2 To consider

  1. Mount the terragrunt root project dir (/my/tf/) into /data/ into the container
  2. Use the workding dir (-w or --workdir) to point to your project inside the container
  3. Add AWS credentials from your environment to the container

1.3 Docker commands

# Initialize the MySQL project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/mysql \
  cytopia/terragrunt terragrunt init

# Plan the MySQL project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/mysql \
  cytopia/terragrunt terragrunt plan

# Apply the MySQL project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/mysql \
  cytopia/terragrunt terragrunt --terragrunt-non-interactive apply

2. Complex: Provision single sub-project on AWS

2.1 Project overview

Let's assume your Terragrunt project setup is as follows:

/my/tf                                              # Terragrunt project root
└── envs
    └── aws
        ├── dev
        │   ├── eu-central-1
        │   │   ├── infra
        │   │   │   └── vpc-k8s                     # VPC sub-project directory
        │   │   │       ├── terraform.tfvars
        │   │   │       └── terragrunt.hcl
        │   │   ├── microservices
        │   │   │   └── api-gateway
        │   │   │       ├── terraform.tfvars
        │   │   │       └── terragrunt.hcl
        │   │   └── region.tfvars
        │   ├── global
        │   │   └── region.tfvars
        │   └── terragrunt.hcl
        └── _provider_include
            └── include_providers.tf

The VPC sub-project you want to provision is at the relative path envs/aws/dev/eu-centra-1/infra/vpc-k8s/.

2.2 To consider

  1. Mount the terragrunt root project dir (/my/tf/) into /data/ into the container
  2. Use the workding dir (-w or --workdir) to point to your project inside the container
  3. Add AWS credentials from your environment to the container

2.3 Docker commands

# Initialize the VPC project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/envs/aws/dev/eu-central-1/infra/vpc-k8s \
  cytopia/terragrunt terragrunt init

# Plan the VPC project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/envs/aws/dev/eu-central-1/infra/vpc-k8s \
  cytopia/terragrunt terragrunt plan

# Apply the VPC project
docker run --rm \
  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
  -u $(id -u):$(id -g) \
  -v /my/tf:/data \
  -w /data/envs/aws/dev/eu-central-1/infra/vpc-k8s \
  cytopia/terragrunt terragrunt --terragrunt-non-interactive apply

🔄 Related #awesome-ci projects

Docker images

Save yourself from installing lot's of dependencies and pick a dockerized version of your favourite linter below for reproducible local or remote CI tests:

GitHub DockerHub Type Description
awesome-ci aci-hub-img Basic Tools for git, file and static source code analysis
file-lint flint-hub-img Basic Baisc source code analysis
linkcheck linkcheck-hub-img Basic Search for URLs in files and validate their HTTP status code
ansible ansible-hub-img Ansible Multiple versions and flavours of Ansible
ansible-lint alint-hub-img Ansible Lint Ansible
gofmt gfmt-hub-img Go Format Go source code [1]
goimports gimp-hub-img Go Format Go source code [1]
golint glint-hub-img Go Lint Go code
eslint elint-hub-img Javascript Lint Javascript code
jsonlint jlint-hub-img JSON Lint JSON files [1]
kubeval kubeval-hub-img K8s Lint Kubernetes files
checkmake cm-hub-img Make Lint Makefiles
phpcbf pcbf-hub-img PHP PHP Code Beautifier and Fixer
phpcs pcs-hub-img PHP PHP Code Sniffer
phplint plint-hub-img PHP PHP Code Linter [1]
php-cs-fixer pcsf-hub-img PHP PHP Coding Standards Fixer
bandit bandit-hub-img Python A security linter from PyCQA
black black-hub-img Python The uncompromising Python code formatter
mypy mypy-hub-img Python Static source code analysis
pycodestyle pycs-hub-img Python Python style guide checker
pydocstyle pyds-hub-img Python Python docstyle checker
pylint pylint-hub-img Python Python source code, bug and quality checker
terraform-docs tfdocs-hub-img Terraform Terraform doc generator (TF 0.12 ready) [1]
terragrunt tg-hub-img Terraform Terragrunt and Terraform
terragrunt-fmt tgfmt-hub-img Terraform terraform fmt for Terragrunt files [1]
yamlfmt yfmt-hub-img Yaml Format Yaml files [1]
yamllint ylint-hub-img Yaml Lint Yaml files

[1] Uses a shell wrapper to add enhanced functionality not available by original project.

Makefiles

Visit cytopia/makefiles for dependency-less, seamless project integration and minimum required best-practice code linting for CI. The provided Makefiles will only require GNU Make and Docker itself removing the need to install anything else.

📄 License

MIT License

Copyright (c) 2019 cytopia

docker-terragrunt's People

Contributors

cytopia avatar dependabot[bot] avatar jcolfej avatar snovikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-terragrunt's Issues

Support latest Terragrunt

it would be nice if latest Terragrunt was supported, v0.23.2.
I could make a PR but it is not clear if only the ci file needed to be extended or more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.