This tool parses Terraform plan files in JSON format and gives feedback about the changes.
This tool aims to parse Terraform plan files (in JSON format) and gives feedback to several types of outputs.
Outputs can be:
- stdout: stdout
- azuredevops: Azure DevOps pull request comment
- github: Github pull request comment (not yet implemented)
To create the Terraform plan file:
terraform init
terraform plan -out=plan.out
terraform show -no-color -json plan.out > plan.json
To write to stdout you just need to pass a JSON file:
❯ terraplanfeed ../tfplan/example.json
Summary of changes:
===================
(✨): <known after apply> (module.failover_rg.azurerm_resource_group.rg)
(✨): <known after apply> (module.failover_rg.module.naming.random_string.first_letter)
(✨): <known after apply> (module.failover_rg.module.naming.random_string.main)
(✨): <known after apply> (module.rg.azurerm_resource_group.rg)
(✨): <known after apply> (module.rg.module.naming.random_string.first_letter)
(✨): <known after apply> (module.rg.module.naming.random_string.main)
(✨): <known after apply> (module.sql.azurerm_storage_account.audit1)
(✨): <known after apply> (module.sql.azurerm_storage_account.audit2[0])
(✨): <known after apply> (module.sql.module.naming.random_string.first_letter)
(✨): <known after apply> (module.sql.module.naming.random_string.main)
(✨): <known after apply> (module.sql.module.naming_failover.random_string.first_letter)
(✨): <known after apply> (module.sql.module.naming_failover.random_string.main)
❯ terraplanfeed ../tfplan/example.json -o azuredevops
To use this on Azure DevOps you need the following environment variables:
- SYSTEM_TEAMFOUNDATIONSERVERURI
- SYSTEM_TEAMPROJECT
- BUILD_REPOSITORY_ID
- SYSTEM_PULLREQUEST_PULLREQUESTID
- SYSTEM_ACCESSTOKEN
these environment variables are present when you run Azure DevOps pipelines.
Note: The SYSTEM_PULLREQUEST_PULLREQUESTID
is only present when you run
pipeline in a pull request.
If any of these environment variables are not present, output defaults to stdout
python3 -m pip install --editable .
To build and upload to Test PyPI repository:
python3 -m pip install --user --upgrade setuptools wheel
python3 setup.py sdist bdist_wheel
python3 -m pip install --user --upgrade twine
python3 -m twine upload --repository testpypi dist/*
To upload to PyPI repository:
python3 -m twine upload dist/*
Read the pre-commit hooks document for more info.
Read the git-chglog document for more info.