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

core: avoid diff mismatch on NewRemoved fields during -/+ #1515

Merged
merged 1 commit into from
Apr 14, 2015

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Apr 14, 2015

fixes #1508

In a DESTROY/CREATE scenario, the plan diff will be run against the
state of the old instance, while the apply diff will be run against an
empty state (because the state is cleared when the destroy node does its
thing.)

For complex attributes, this can result in keys that seem to disappear
between the two diffs, when in reality everything is working just fine.

Same() needs to take into account this scenario by analyzing NewRemoved
and treating as "Same" a diff that does indeed have that key removed.

// to be removed, that's just fine.
if diffOld.NewRemoved {
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline after this, but so simple!

@mitchellh
Copy link
Contributor

This looks great. Love the army of tests.

@mitchellh
Copy link
Contributor

🚢

fixes #1508

In a DESTROY/CREATE scenario, the plan diff will be run against the
state of the old instance, while the apply diff will be run against an
empty state (because the state is cleared when the destroy node does its
thing.)

For complex attributes, this can result in keys that seem to disappear
between the two diffs, when in reality everything is working just fine.

Same() needs to take into account this scenario by analyzing NewRemoved
and treating as "Same" a diff that does indeed have that key removed.
@phinze phinze force-pushed the b-diff-mismatch-on-instance-replacement branch from 1000a0a to 64f0897 Compare April 14, 2015 22:23
phinze added a commit that referenced this pull request Apr 14, 2015
…eplacement

core: avoid diff mismatch on NewRemoved fields during -/+
@phinze phinze merged commit 6365b3a into master Apr 14, 2015
@phinze phinze deleted the b-diff-mismatch-on-instance-replacement branch April 14, 2015 22:44
@ghost
Copy link

ghost commented May 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diff mismatch when changing ForceNew and k/v attribute together
2 participants