Parse Terraform plan in json format and give feedback.
Project description
terraplanfeed
This tool parses Terraform plan files in JSON format and gives feedback about the changes.
Description
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
Usage
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
Run and test locally
python3 -m pip install --editable .
Build and upload to PyPI
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/*
pre-commit hooks
Read the pre-commit hooks document for more info.
git-chglog
Read the git-chglog document for more info.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file terraplanfeed-0.9.2.tar.gz
.
File metadata
- Download URL: terraplanfeed-0.9.2.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1ad4143c3fbdc37402170583ddedf35b2cc201fbcdf804e360a12aabf2b2214 |
|
MD5 | 3cb84588ffbc7fa3b3ab656aed98e3c1 |
|
BLAKE2b-256 | c957eab4013bbf460099645a9147573f411417f878ab8c12f5a770faca910b5d |
File details
Details for the file terraplanfeed-0.9.2-py2.py3-none-any.whl
.
File metadata
- Download URL: terraplanfeed-0.9.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ad1ab19cec1d83a857496f013d0f86d13c735eab0ac740f0d1d4ea0a8c0bd02 |
|
MD5 | d93bbf5ee62ccec7ab1b23c5ccbc4523 |
|
BLAKE2b-256 | 258533a9628e64e21746042b46933c6478d81678f9029e9e7cd3c895201d4675 |