Conversation
…dditions When ignore_server_additions=true and an update is triggered by a change to update_data, update_path, update_method, path, or object_id (while data itself is unchanged), ModifyPlan was locking plan.APIData to the prior state value. After the update the server returns new api_data (e.g. a changed updated_at timestamp), which no longer matched the locked planned value, causing "Provider produced inconsistent result after apply". Fix by marking api_data and api_response as unknown in the plan whenever any update-triggering attribute has changed, so Terraform does not enforce a specific post-apply value. Fixes Mastercard#355
3 tasks
|
@DRuggeri - Could you please review this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #355
Problem
When
ignore_server_additions = trueand an update is triggered by a change toupdate_data,update_path,update_method,path, orobject_id(whiledataitself is unchanged),ModifyPlanwas lockingplan.APIDatato the prior state value. After the update the server returns newapi_data(e.g. a changedupdated_attimestamp), which no longer matches the locked planned value, producing:Root cause
ModifyPlanchecked onlyplan.Data.Equal(state.Data)to decide whether to lockapi_data. This missed the case wheredatais unchanged but another attribute (e.g.update_data) triggers an update.Fix
Mark
api_dataandapi_responseas unknown in the plan whenever any update-triggering attribute has changed, so Terraform does not enforce a specific post-apply value.Test
Added
TestAccRestApiObject_IgnoreServerAdditions_Updatewhich:api_datais still preserved when nothing changes