Use saved plan to determine CreateBeforeDestroy status #26192
Merged
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.
If the planed action changes from CreateThenDelete to DeleteThenCreate,
terraform will present an error like:
This was being reported to providers as the message indicated, so wasn't
immediately visible to core developers, e.g.
hashicorp/terraform-provider-aws#15044
hashicorp/terraform-provider-aws#15048
https://discuss.hashicorp.com/t/this-is-a-bug-in-the-provider-which-should-be-reported-in-the-providers-own-issue-tracker/13190
hashicorp/terraform-provider-aws#13823 (comment)
hashicorp/terraform-provider-aws#10297 (comment)
Since the provider does not influence the status of
CreateBeforeDestroy
,we first fix the output to indicate that this is a bug in terraform.
In order to prevent the error, we need to check for a saved plan with a
CreateThenDelete
action and rely on that to determine the status ofCreateBeforeDestroy
. Due to the eval-node pattern currently in use,this needs to be maintained in both the apply node and the eval nodes.
Future refactoring can work on unifying these codepaths, and making
these internal flags less fragile.
Fixes #26180