Generate and review Terraform execution plan
Generates Terraform execution plan showing resource changes before apply.
/plugin marketplace add JosiahSiegel/claude-plugin-marketplace/plugin install terraform-master@claude-plugin-marketplace[var-file] [-target=resource] [-out=planfile]Generate an execution plan showing what Terraform will do.
/tf-plan # Basic plan
/tf-plan prod.tfvars # With var file
/tf-plan -target=module.vpc # Target specific resource
/tf-plan -out=tfplan # Save plan to file
# Verify initialization
terraform validate
# Check formatting
terraform fmt -check
# Basic plan
terraform plan
# With var file
terraform plan -var-file="${ARGS}"
# With target
terraform plan -target="${TARGET}"
# Save plan
terraform plan -out=tfplan
# CI/CD optimized
terraform plan -no-color -out=tfplan -detailed-exitcode
Plan output shows:
+ Resources to create- Resources to destroy~ Resources to modify+/- Resources to replace| Option | Description |
|---|---|
-var-file=FILE | Load variables from file |
-var='KEY=VALUE' | Set individual variable |
-target=RESOURCE | Plan specific resource |
-out=FILE | Save plan to file |
-refresh=false | Skip state refresh |
-detailed-exitcode | Return 2 if changes |
-no-color | Disable colored output |
-parallelism=N | Limit parallel operations |
| Code | Meaning |
|---|---|
| 0 | No changes |
| 1 | Error |
| 2 | Changes detected |
terraform plan
terraform plan -var-file="environments/prod.tfvars"
terraform plan -target=aws_instance.web
terraform plan -target=module.networking
terraform plan \
-no-color \
-out=tfplan \
-detailed-exitcode \
-var-file="prod.tfvars"
-detailed-exitcode for automation