Terraform Version
$ terraform -v
Terraform v0.12.15
Expected Behavior
as per help, terraform plan -detailed-exitcode should return:
0 - Succeeded, diff is empty (no changes)
1 - Errored
2 - Succeeded, there is a diff
Actual Behavior
terraform plan -detailed-exitcode -destroy returns '2' on already destroyed infra.
Steps to Reproduce
On an already destroyed infra (I'm using shared state/lock on S3/DynamoDB):
terraform init
terraform plan -detailed-exitcode -destroy -out=./planfile
$?. It returns 2 code, and the following message to stdout:
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Then, upon acting on the plan...
$ terraform show ./planfile
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 0 to destroy.
Additional Context
This behaviour has changed a bit since Terraform v0.12.10: while the plan step produced the same stdout, and exit code, terraform show offered a different message:
$ terraform show ./planfile
This plan does nothing.
References
This behaviour is neither the first, nor the second, nor the third time it gets described:
Terraform Version
Expected Behavior
as per help, terraform plan -detailed-exitcode should return:
Actual Behavior
terraform plan -detailed-exitcode -destroyreturns '2' on already destroyed infra.Steps to Reproduce
On an already destroyed infra (I'm using shared state/lock on S3/DynamoDB):
terraform initterraform plan -detailed-exitcode -destroy -out=./planfile$?. It returns 2 code, and the following message to stdout:Then, upon acting on the plan...
Additional Context
This behaviour has changed a bit since Terraform v0.12.10: while the plan step produced the same stdout, and exit code,
terraform showoffered a different message:References
This behaviour is neither the first, nor the second, nor the third time it gets described: