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

Add replaceOnUpdate annotation to force resource replacement #1563

Closed
wants to merge 1 commit into from

Conversation

lblackstone
Copy link
Member

@lblackstone lblackstone commented May 4, 2021

Proposed changes

Setting pulumi.com/replaceOnUpdate to "true" will cause the resource
to be replaced on subsequent updates.

Reviewer note:
I still need to add tests, but wanted to make sure the overall approach makes sense.

Here's an example of what this looks like in the CLI with the annotation set.
Screen Shot 2021-05-04 at 3 52 03 PM

Related issues (optional)

Fix #1007

Setting `pulumi.com/replaceOnUpdate` to "true" will cause the resource
to be replaced on subsequent updates.
@lblackstone lblackstone requested review from lukehoban and viveklak May 4, 2021 21:49
@github-actions
Copy link

github-actions bot commented May 4, 2021

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

// If the replaceOnUpdate annotation is "true", then schedule the resource for replacement.
if metadata.ReplaceOnUpdate(newInputs) {
hasChanges = pulumirpc.DiffResponse_DIFF_SOME
replaces = append(replaces, `.metadata.annotations["pulumi.com/replaceOnUpdate"]`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this force a diff and replacement always, even if there are no changes? I thought the goal was to replace only if there were changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will this force a diff and replacement always, even if there are no changes?

Correct. I thought this would be required for the Job replacement case, but narrowing it to only apply on changes does seem preferable. I'll do some more testing today.

@lblackstone
Copy link
Member Author

I'm closing this in favor of the more general solution in pulumi/pulumi#7226

@lblackstone lblackstone closed this Jun 7, 2021
@lblackstone lblackstone deleted the lblackstone/replace-annotation branch July 14, 2021 22:51
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.

Give the possibility to set an annotation that forces resource re-creation
2 participants