Skip to content

Question: Why does tfmigrate gate on terraform plan -detailed-exitcode for diffs (including output-only), and can output-only changes be treated as no-op? #221

@axon-zzhu

Description

@axon-zzhu

Context

In our migrations, we move resources between modules while legitimately changing module outputs (e.g., renaming/reformatting). No real resources change.

From what we can see, tfmigrate relies on terraform plan -detailed-exitcode to decide whether a migration is “clean.”

Because exit code 2 is returned for any diff (including output-only), tfmigrate treats these as failures.

Using force to proceed despite diffs is too coarse/risky—we want to fail on real resource changes but allow outputs to vary.

Questions

Was relying on the exit code an intentional “any diff = fail” safety choice, or mainly for simplicity?

Would you have any concerns if we validated no-op by parsing terraform show -json or terraform plan -output json and confirming there are no resource actions (create/delete/replace), while ignoring .output_changes?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions