Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue to plan to_dir for multi_state if force is true #139

Merged

Conversation

chrissng
Copy link
Contributor

@chrissng chrissng commented Jun 10, 2023

What

In multi_state mode, from_dir will be planned first before planning the to_dir. When force = true and there are unexpected diffs for the from_dir, the check for the to_dir will be skipped.

If to_dir check is skipped in this case, we wont be able to confirm any unexpected changes.

This PR addresses this issue by ensuring that both from_dir and to_dir will be checked.

How

If force = true and there are unexpected diffs in the from_dir plan check, instead of returning the function immediately, continue to check to_dir.

Copy link
Owner

@minamijoyo minamijoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrissng Thank you for the fix! LGTM 👍

@minamijoyo minamijoyo merged commit 5f008cf into minamijoyo:master Jun 12, 2023
@minamijoyo
Copy link
Owner

I'm waiting for Terraform v1.5 reaches to GA before I cut a new release of tfmigrate, but even if it doesn't come soon, I will cut a new release in a week or so.

@minamijoyo
Copy link
Owner

tfmigrate v0.3.12 has been released.

minamijoyo added a commit that referenced this pull request Aug 3, 2023
Fixes #140

We slightly fixed the behavior of the force option in #139, but the fix
introduced a regression in error handling; errors in plan commands,
except for detected diffs, should not be ignored regardless of force or
not.
A single-state migration implementation did not have this bug because it
had a similar but different implementation, but I'll take this
opportunity to use the same logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants