[Fix] Allow child resources to override parent's protect setting#2156
Conversation
|
@Frassle Your take on how to best go about releasing this in the Java SDK? |
| @@ -370,7 +382,7 @@ public Output<List<Resource>> getDependsOn() { | |||
| * @see Builder#protect(boolean) | |||
| */ | |||
| public boolean isProtect() { | |||
There was a problem hiding this comment.
This is what's actually used to set the RegisterResource request, so I think we need another method here "isProtectNullable"(?) to check in the register resource code to work out if we should actually send true, false, or null to the engine.
Also it would be good to get the l2-resource-parent-inheritance test passing with this change, even if it requires a manually written program file.
There was a problem hiding this comment.
@Frassle Went with Optional<Boolean> getProtect() instead, similar to the other Optional<> getters.
And for the test: retainOnDelete needed the same tri-state fix to make it pass, and while in there, deleteBeforeReplace had the same bug. Saw your draft in #1956 was heading the same way, so applied the pattern across all three.
Tests passed locally.
|
Hi @Frassle, no rush, but could you review when you get a chance. Was hoping to get the fix deployed for Java users. |
Frassle
left a comment
There was a problem hiding this comment.
Looks reasonable to me, just get a changelog added and we can merge
Thank you. Added the change-log. |
|
This PR has been shipped in release v1.27.0. |
Summary
Allow a child resource to override its parent's
protectsetting in the Java SDK.This PR:
@Nullable Booleanso explicitfalseis distinguishable.protect(@Nullable Boolean)builder overload, existing.protect(true)/.protect(false)calls work as-is.Fixes the Java side of pulumi/pulumi#18935. Matches the Go fix in pulumi/pulumi#18862 pulumi/pulumi#18924.
Questions
retainOnDelete. Good to fold it into this one?