$ terraform -v
Terraform v0.12.15
as per help, terraform plan -detailed-exitcode should return:
0 - Succeeded, diff is empty (no changes)
1 - Errored
2 - Succeeded, there is a diff
terraform plan -detailed-exitcode -destroy returns '2' on already destroyed infra.
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:------------------------------------------------------------------------
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.
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.
This behaviour is neither the first, nor the second, nor the third time it gets described:
Hey @danieldreier I'm a new contributor and I'm willing to contribute on this. Please advise if I can proceed to start working on it. Thanks
I'm experiencing the same issue on terraform plan -detailed-exitcode -destroy this is my output:
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.
script returned exit code 2
Hello same issue
```------------------------------------------------------------------------
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.
Changes to Outputs:
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.```
echo $?
2
on terraform 0.13.0 on 0.12.26 it was OK
I can confirm this bug is still present on terraform v0.13.0.
I can confirm it is present in terraform v0.13.5. We had one check that flagged a change in a datasource which caused exit code 2
Most helpful comment
Hey @danieldreier I'm a new contributor and I'm willing to contribute on this. Please advise if I can proceed to start working on it. Thanks