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
, arm/v7
, arm/v6
Tiny Alpine-based multistage-build dockerized version of terraform-docs[1],
which additionally implements terraform-docs-replace
allowing you to automatically and safely
replace the terraform-docs
generated output infile.
Furthermore this implementation is also Terraform >= 0.12 ready[2]. See Generic Usage for more details.
The image is built nightly against multiple stable versions and pushed to Dockerhub.
- [1] Official project: https://github.com/terraform-docs/terraform-docs
- [2] Based on an awk script by cloudposse/build-harness
The following Docker image tags are rolling releases and are built and updated every night.
Docker Tag | Git Ref | Terraform Docs | Available Architectures |
---|---|---|---|
latest |
master | latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.16.0 |
master | 0.16.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.15.0 |
master | 0.15.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.14.1 |
master | 0.14.1 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.14.0 |
master | 0.14.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.13.0 |
master | 0.13.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.12.1 |
master | 0.12.1 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.12.0 |
master | 0.12.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.11.2 |
master | 0.11.2 |
amd64 |
0.11.1 |
master | 0.11.1 |
amd64 |
0.11.0 |
master | 0.11.0 |
amd64 |
0.10.1 |
master | 0.10.1 |
amd64 |
0.10.0 |
master | 0.10.0 |
amd64 |
0.9.1 |
master | 0.9.1 |
amd64 |
0.9.0 |
master | 0.9.0 |
amd64 |
0.8.2 |
master | 0.8.2 |
amd64 |
0.8.1 |
master | 0.8.1 |
amd64 |
0.8.0 |
master | 0.8.0 |
amd64 |
0.7.0 |
master | 0.7.0 |
amd64 |
0.6.0 |
master | 0.6.0 |
amd64 |
0.5.0 |
master | 0.5.0 |
amd64 |
0.4.5 |
master | 0.4.5 |
amd64 |
0.4.0 |
master | 0.4.0 |
amd64 |
0.3.0 |
master | 0.3.0 |
amd64 |
0.2.0 |
master | 0.2.0 |
amd64 |
0.1.1 |
master | 0.1.1 |
amd64 |
0.1.0 |
master | 0.1.0 |
amd64 |
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.
Docker Tag | Git Ref | Terraform Docs | Available Architectures |
---|---|---|---|
latest-0.32 |
tag: 0.32 | latest | amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.16.0-0.32 |
tag: 0.32 | 0.16.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.15.0-0.32 |
tag: 0.32 | 0.15.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.14.1-0.32 |
tag: 0.32 | 0.14.1 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.14.0-0.32 |
tag: 0.32 | 0.14.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.13.0-0.32 |
tag: 0.32 | 0.13.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.12.1-0.32 |
tag: 0.32 | 0.12.1 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.12.0-0.32 |
tag: 0.32 | 0.12.0 |
amd64 , i386 , arm64 , arm/v7 , arm/v6 |
0.11.2-0.32 |
tag: 0.32 | 0.11.2 |
amd64 |
0.11.1-0.32 |
tag: 0.32 | 0.11.1 |
amd64 |
0.11.0-0.32 |
tag: 0.32 | 0.11.0 |
amd64 |
0.10.1-0.32 |
tag: 0.32 | 0.10.1 |
amd64 |
0.10.0-0.32 |
tag: 0.32 | 0.10.0 |
amd64 |
0.9.1-0.32 |
tag: 0.32 | 0.9.1 |
amd64 |
0.9.0-0.32 |
tag: 0.32 | 0.9.0 |
amd64 |
0.8.2-0.32 |
tag: 0.32 | 0.8.2 |
amd64 |
0.8.1-0.32 |
tag: 0.32 | 0.8.1 |
amd64 |
0.8.0-0.32 |
tag: 0.32 | 0.8.0 |
amd64 |
0.7.0-0.32 |
tag: 0.32 | 0.7.0 |
amd64 |
0.6.0-0.32 |
tag: 0.32 | 0.6.0 |
amd64 |
0.5.0-0.32 |
tag: 0.32 | 0.5.0 |
amd64 |
0.4.5-0.32 |
tag: 0.32 | 0.4.5 |
amd64 |
0.4.0-0.32 |
tag: 0.32 | 0.4.0 |
amd64 |
0.3.0-0.32 |
tag: 0.32 | 0.3.0 |
amd64 |
0.2.0-0.32 |
tag: 0.32 | 0.2.0 |
amd64 |
0.1.1-0.32 |
tag: 0.32 | 0.1.1 |
amd64 |
0.1.0-0.32 |
tag: 0.32 | 0.1.0 |
amd64 |
The following Docker environment variables are available. These will only need to be used when
using terraform-docs-replace
or terraform-docs-replace-012
.
Variable | Default | Required | Comment |
---|---|---|---|
DELIM_START | <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
No | The starting delimiter in the file in where you want to replace the terraform-docs output. |
DELIM_CLOSE | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
No | The ending delimiter in the file in where you want to replace the terraform-docs output. |
The working directory inside the Docker container is /data/
and should be mounted locally to
where your Terraform module is located.
Usage: cytopia/terraform-docs terraform-docs <ARGS> .
cytopia/terraform-docs terraform-docs-012 <ARGS> .
cytopia/terraform-docs terraform-docs-replace <ARGS> <PATH-TO-FILE>
cytopia/terraform-docs terraform-docs-replace-012 <ARGS> <PATH-TO-FILE>
terraform-docs Output as expected from terraform-docs
terraform-docs-012 Same as above, but used for Terraform >= 0.12 modules
terraform-docs-replace Replaces directly inside README.md, if DELIM_START and DELIM_CLOSE are found.
terraform-docs-replace-012 Same as above, but used for Terraform >= 0.12 modules
<ARGS> All arguments terraform-docs command can use.
<PATH-TO-FILE> File in where to auto-replace terraform-docs block.
Create markdown output and sent to stdout:
# [Terraform < 0.12]
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs --sort-by-required md .
# [Terraform >= 0.12]
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs-012 --sort-by-required md .
Create README.md with terraform-docs
output:
# [Terraform < 0.12]
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs --sort-by-required md . > README.md
# [Terraform >= 0.12]
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs-012 --sort-by-required md . > README.md
Replace current terraform-docs
blocks in README.md with current one in order to automatically
keep it up to date. For this to work, the terraform-docs
information must be wrapped with the
following delimiter by default:
README.md:
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs
...
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
# [Terraform < 0.12]
# Path to README.md must be specified as last command.
# Note that the command changes from terraform-docs to terraform-docs-replace
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs-replace --sort-by-required md README.md
# [Terraform >= 0.12]
# Path to README.md must be specified as last command.
# Note that the command changes from terraform-docs to terraform-docs-replace
docker run --rm \
-v $(pwd):/data \
cytopia/terraform-docs \
terraform-docs-replace-012 --sort-by-required md README.md
You are able to use different delimiter. Let's imagine the following delimiter:
INFO.md:
<!-- TFDOC_START -->
## Inputs
...
<!-- TFDOC_END -->
# [Terraform < 0.12]
# Path to INFO.md must be specified as last command.
# Note that the command changes from terraform-docs to terraform-docs-replace
docker run --rm \
-v $(pwd):/data \
-e DELIM_START='<!-- TFDOC_START -->' \
-e DELIM_CLOSE='<!-- TFDOC_END -->' \
cytopia/terraform-docs \
terraform-docs-replace --sort-by-required md INFO.md
# [Terraform >= 0.12]
# Path to INFO.md must be specified as last command.
# Note that the command changes from terraform-docs to terraform-docs-replace
docker run --rm \
-v $(pwd):/data \
-e DELIM_START='<!-- TFDOC_START -->' \
-e DELIM_CLOSE='<!-- TFDOC_END -->' \
cytopia/terraform-docs \
terraform-docs-replace-012 --sort-by-required md INFO.md
You can add the following Makefile to your project for easy generation of terraform-docs output in a Terraform module. It takes into consideration the Main module, sub-modules and examples.
ifneq (,)
.error This Makefile requires GNU Make.
endif
.PHONY: gen _gen-main _gen-examples _gen-modules _update-tf-docs
CURRENT_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TF_EXAMPLES = $(sort $(dir $(wildcard $(CURRENT_DIR)examples/*/)))
TF_MODULES = $(sort $(dir $(wildcard $(CURRENT_DIR)modules/*/)))
TF_DOCS_VERSION = 0.6.0
# Adjust your delimiter here or overwrite via make arguments
DELIM_START = <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
DELIM_CLOSE = <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
gen: _update-tf-docs
@echo "################################################################################"
@echo "# Terraform-docs generate"
@echo "################################################################################"
@$(MAKE) --no-print-directory _gen-main
@$(MAKE) --no-print-directory _gen-examples
@$(MAKE) --no-print-directory _gen-modules
_gen-main:
@echo "------------------------------------------------------------"
@echo "# Main module"
@echo "------------------------------------------------------------"
@if docker run --rm \
-v $(CURRENT_DIR):/data \
-e DELIM_START='$(DELIM_START)' \
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
cytopia/terraform-docs:$(TF_DOCS_VERSION) \
terraform-docs-replace --sort-by-required md README.md; then \
echo "OK"; \
else \
echo "Failed"; \
exit 1; \
fi
_gen-examples:
@$(foreach example,\
$(TF_EXAMPLES),\
DOCKER_PATH="examples/$(notdir $(patsubst %/,%,$(example)))"; \
echo "------------------------------------------------------------"; \
echo "# $${DOCKER_PATH}"; \
echo "------------------------------------------------------------"; \
if docker run --rm \
-v $(CURRENT_DIR):/data \
-e DELIM_START='$(DELIM_START)' \
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
cytopia/terraform-docs:$(TF_DOCS_VERSION) \
terraform-docs-replace --sort-by-required md $${DOCKER_PATH}/README.md; then \
echo "OK"; \
else \
echo "Failed"; \
exit 1; \
fi; \
)
_gen-modules:
@$(foreach module,\
$(TF_MODULES),\
DOCKER_PATH="modules/$(notdir $(patsubst %/,%,$(module)))"; \
echo "------------------------------------------------------------"; \
echo "# $${DOCKER_PATH}"; \
echo "------------------------------------------------------------"; \
if docker run --rm \
-v $(CURRENT_DIR):/data \
-e DELIM_START='$(DELIM_START)' \
-e DELIM_CLOSE='$(DELIM_CLOSE)' \
cytopia/terraform-docs:$(TF_DOCS_VERSION) \
terraform-docs-replace --sort-by-required md $${DOCKER_PATH}/README.md; then \
echo "OK"; \
else \
echo "Failed"; \
exit 1; \
fi; \
)
_update-tf-docs:
docker pull cytopia/terraform-docs:$(TF_DOCS_VERSION)
With the above Makefile in place, you can easily add a Travis CI rule to ensure the terraform-docs output is always up-to-date and will fail otherwise (due to git changes):
---
sudo: required
language: minimal
services:
- docker
script:
- make gen
- git diff --quiet || { echo "Build Changes"; git diff; git status; false; }
Find below some example projects how this Docker image is used in CI to verify if the README.md has
been updated with the latest changes generated from terraform-docs
:
- https://github.com/cytopia/terraform-aws-rds/blob/master/Makefile
- https://github.com/Flaconi/terraform-aws-microservice/blob/master/Makefile
Related #awesome-ci projects
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 | Basic | Tools for git, file and static source code analysis | |
file-lint | Basic | Baisc source code analysis | |
linkcheck | Basic | Search for URLs in files and validate their HTTP status code | |
ansible | Ansible | Multiple versions and flavours of Ansible | |
ansible-lint | Ansible | Lint Ansible | |
gofmt | Go | Format Go source code [1] | |
goimports | Go | Format Go source code [1] | |
golint | Go | Lint Go code | |
eslint | Javascript | Lint Javascript code | |
jsonlint | JSON | Lint JSON files [1] | |
kubeval | K8s | Lint Kubernetes files | |
checkmake | Make | Lint Makefiles | |
phpcbf | PHP | PHP Code Beautifier and Fixer | |
phpcs | PHP | PHP Code Sniffer | |
phplint | PHP | PHP Code Linter [1] | |
php-cs-fixer | PHP | PHP Coding Standards Fixer | |
bandit | Python | A security linter from PyCQA | |
black | Python | The uncompromising Python code formatter | |
mypy | Python | Static source code analysis | |
pycodestyle | Python | Python style guide checker | |
pydocstyle | Python | Python docstyle checker | |
pylint | Python | Python source code, bug and quality checker | |
terraform-docs | Terraform | Terraform doc generator (TF 0.12 ready) [1] | |
terragrunt | Terraform | Terragrunt and Terraform | |
terragrunt-fmt | Terraform | terraform fmt for Terragrunt files [1] |
|
yamlfmt | Yaml | Format Yaml files [1] | |
yamllint | Yaml | Lint Yaml files |
[1] Uses a shell wrapper to add enhanced functionality not available by original project.
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.
Copyright (c) 2019 cytopia