Skip to content

Misleading return code when running terraform plan #18453

@valadan

Description

@valadan

Terraform Version

v0.11.7

Terraform command entered

terraform plan -destroy -detailed-exitcode 

Expected Behavior

This is a new project and no infrastructure has been created as yet.

In the presence of the -detailed-exitcode option, I would expect the return code to be 0 (i.e. Succeeded with empty diff - no changes)

Actual Behavior

The command completes with a return code of 2 (i.e. Succeeded with non-empty diff - changes present)

In this case, the return code is misleading since there is no infrastructure to destroy since nothing has been created as yet.

Steps to Reproduce

Run the following command

  1. terraform plan -destroy -detailed-exitcode

Additional Context

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions