What does `-detailed-exitcode` do?
IntermediateConceptWorkflow and CLI
Answer
With terraform plan -detailed-exitcode, exit code 0 means no changes, 1 means error and 2 means changes are present. We use it in scheduled drift-detection jobs: exit 2 raises an alert.
terraform plan -detailed-exitcode -input=false -lock=false; echo $?
More on Workflow and CLI
What does `terraform init` do?BeginnerWhat does `terraform plan` do?BeginnerWhat does `terraform apply` do and what is `-auto-approve`?BeginnerWhat does `terraform destroy` do?BeginnerWhat do `terraform fmt` and `terraform validate` check?BeginnerWhy save a plan with `-out` and apply that file?Intermediate