a small utility for reading terraform plan output and used to setup basic ci/cd guard rails.
Basic Usage
This just reads the output and prints out a simplified summary of the changes.
echo $(terraform plan -json) | terraform read
# If using fish...
echo (terraform plan -json) | terraform readDestroy Guard Usage
This option will not only print out the summary but also exit with code 1 in order to be used as a way to abort a CI/CD pipeline.
echo $(terraform plan -json) | terraform guard -d
# If using fish...
echo (terraform plan -json) | terraform guard -dGuard Options
terra-translate guard -awill exit with code 1 if any additional resources would be createdterra-translate guard -cwill exit with code 1 if any existing resources would be changedterra-translate guard -dwill exit with code 1 if any existing resources would be destroyed
these flags can also be combined. for example the below snippit would only allow changes to existing resources but no additional resources or destructive changes.:
echo $(terraform plan -json) | terraform guard -d -a
# If using fish...
echo (terraform plan -json) | terraform guard -d -a