Skip to content

Current comparison approach is non-deterministic resulting in false positives plan drifts #196

@toast-gear

Description

@toast-gear

Problem description

Relates to #177

Terraform's human readable output, the output we attach to the PR and use as a point of comparison, is not deterministic and as a result it fails with false positive drift errors when comparing the plan at execution time with the plan in the PR.

As pointed out in hashicorp/terraform#30934

If you need more detail than just whether the plan includes changes at all, you can save the plan to a file with terraform plan -out=tfplan and then use terraform show -json tfplan to obtain a machine-readable description of the plan. A wrapper program can then use arbitrary logic against that data structure to decide how to proceed.

In order to have a determanistic comparison between the approved plan in the PR and the plan generated at execution time we should comparing the JSON. Perhaps the json version of the plan needs to be included in the PR comment (perhaps hidden maybe?) in addition to the human readable version so we can compare plans in a determanistic way preventing false positive plan drifts?

Terraform version

any

Backend

any

Workflow YAML

No response

Workflow log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions