Skip to content

a small utility for reading terraform plan output and used to setup basic ci/cd guard rails.

License

Notifications You must be signed in to change notification settings

LucasCarioca/terra-translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terra-translate

GitHub release (latest by date) GitHub Release Date GitHub all releases

GitHub Workflow Status GitHub Workflow Status Coverage Status Go Report Card

DeepSource

a small utility for reading terraform plan output and used to setup basic ci/cd guard rails.

Usage

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 read

Destroy 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 -d

Guard Options

  • terra-translate guard -a will exit with code 1 if any additional resources would be created
  • terra-translate guard -c will exit with code 1 if any existing resources would be changed
  • terra-translate guard -d will 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