terra-inform is a simple wrapper around the Terraform CLI that provides AI-powered summaries of your Terraform plans and applies. It works exactly like the regular Terraform CLI but adds helpful summaries to make infrastructure changes more understandable.
- Works as a drop-in replacement for the Terraform CLI
- Provides AI-generated summaries for
terraform plan
andterraform apply
commands - AI analysis of errors when Terraform commands fail
- Analyzes potential downtime risks from your infrastructure changes
- Maintains all standard Terraform functionality, including interactive approval for applies
- Display full Terraform plan diffs, along side the AI summary - great for sanity checks
- Forwards all other Terraform commands directly to the Terraform CLI
- Configurable OpenAI model selection via CLI flags or environment variables
Here's what terra-inform can do for you:
Before: Standard Terraform output
After: Human readable output, right after the standard output
- Terraform CLI installed and available in your PATH
- OpenAI API key
-
Install Go if you haven't already:
# macOS with Homebrew brew install go
-
Install the package:
go install github.com/ihoegen/terra-inform/cmd/terra-inform@latest
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY='your-api-key-here'
You can configure the AI provider and model either through environment variables or command-line flags.
# Configure the AI model to use (defaults to "gpt-4o")
export TERRA_INFORM_MODEL_NAME='o3-mini'
# Specify the model
terra-inform -m o3-mini plan
Command-line flags take precedence over environment variables.
Use terra-inform exactly as you would use the terraform command:
# Show help
terra-inform --help
# Instead of: terraform plan
terra-inform plan
# Instead of: terraform apply
terra-inform apply
# With model selection
terra-inform -m o3-mini plan
# Any other terraform commands work the same way
terra-inform init
terra-inform validate
terra-inform destroy
When running plan
or apply
, you'll get the standard Terraform output plus an AI-generated analysis that includes:
- A comprehensive summary of the planned changes
- A downtime risk assessment
When Terraform commands fail with errors, terra-inform will automatically analyze the error and provide insights to help you troubleshoot.
MIT License