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

Allow replace if either old or new protect is false #8873

Merged
merged 4 commits into from
Jan 29, 2022
Merged

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Jan 28, 2022

Description

Allow a resource to be replaced if either it's old or new state has the protect flag disabled. Importantly this still doesn't allow a resource to be just deleted in the same update operation that disables it's protect flag.

Fixes #8871

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@Frassle Frassle requested a review from a team January 28, 2022 17:05
@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #8873 (6f752e9) into master (e5f29d1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8873      +/-   ##
==========================================
+ Coverage   59.37%   59.38%   +0.01%     
==========================================
  Files         639      639              
  Lines       98297    98298       +1     
  Branches     1389     1389              
==========================================
+ Hits        58365    58379      +14     
+ Misses      36631    36616      -15     
- Partials     3301     3303       +2     
Impacted Files Coverage Δ
pkg/resource/deploy/step.go 79.37% <100.00%> (+0.02%) ⬆️
pkg/resource/deploy/step_generator.go 84.56% <100.00%> (ø)
sdk/nodejs/automation/localWorkspace.ts 74.03% <0.00%> (-0.39%) ⬇️
pkg/codegen/hcl2/model/type_eventuals.go 93.01% <0.00%> (+0.43%) ⬆️
sdk/go/common/util/ciutil/github_actions.go 73.52% <0.00%> (+38.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5f29d1...6f752e9. Read the comment docs.

@@ -604,7 +604,7 @@ func (sg *stepGenerator) generateStepsFromDiff(
// If this resource is protected we can't replace it because that entails a delete
// Note that we do allow unprotecting and replacing to happen in a single update
// cycle, we don't look at old.Protect here.
if goal.Protect {
Copy link
Member

Choose a reason for hiding this comment

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

Why change between goal.Protect and new.Protect? Will they always agree?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeh we set new.Protect from goal.Protect higher up in the step generator.

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

LGTM

@Frassle Frassle merged commit 73690cd into master Jan 29, 2022
@pulumi-bot pulumi-bot deleted the fraser/fixProtect branch January 29, 2022 08:57
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.

Unable to unprotect and Replace resource without modifying the program to have protect as false
3 participants