-
Notifications
You must be signed in to change notification settings - Fork 37
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
Custom delete for dbforpostgresql:Configuration to reset to the correct default #3752
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3752 +/- ##
==========================================
- Coverage 56.90% 56.80% -0.10%
==========================================
Files 76 77 +1
Lines 11885 11947 +62
==========================================
+ Hits 6763 6787 +24
- Misses 4630 4665 +35
- Partials 492 495 +3 ☔ View full report in Codecov by Sentry. |
new global::Pulumi.Alias { Type = "azure-native:dbforpostgresql/v20200214preview:Configuration" }, | ||
new global::Pulumi.Alias { Type = "azure-native:dbforpostgresql/v20200214privatepreview:Configuration" }, | ||
new global::Pulumi.Alias { Type = "azure-native:dbforpostgresql/v20210410privatepreview:Configuration" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look fine because these resources don't actually exist in the SDK. This is because these are listed in the v2-removed-resources.json
file
547aa68
to
8ea6ac6
Compare
8ea6ac6
to
61d52b0
Compare
61d52b0
to
15819bc
Compare
15819bc
to
ba9989d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this looks fine with the new singleton handling 👍
func isSingleton(resource *resourceVariant) bool { | ||
return resource.PathItem.Delete == nil || customresources.IsSingleton(resource.Path) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a nice place to explain what a singleton is
func isSingleton(resource *resourceVariant) bool { | |
return resource.PathItem.Delete == nil || customresources.IsSingleton(resource.Path) | |
} | |
// isSingleton indicates if the resource is created and therefore deleted as | |
// part of its parent resource. When deleting a singleton we will reset its | |
// properties back to a default state. However a custom resource might still | |
// provide a delete method to perform a custom reset. | |
func isSingleton(resource *resourceVariant) bool { | |
return resource.PathItem.Delete == nil || customresources.IsSingleton(resource.Path) | |
} |
@@ -229,6 +240,13 @@ func HasCustomDelete(path string) bool { | |||
return false | |||
} | |||
|
|||
func IsSingleton(path string) bool { | |||
if res, ok := featureLookup[path]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh .. I find this magic global state for featureLookup
lookup somewhat confusing. I think it was added for easier access at runtime in the provider .. but I guess this is fine to call to call during codegen too.
This PR has been shipped in release v2.76.0. |
Resolves #3476.
The
dbforpostgresql:Configuration
resource cannot actually be deleted, so we reset it to its default value instead. However, there are many configuration parameters with different defaults. On delete, we first GET this configuration to read the correct default value, then set it. This is the same approach thataz
takes inaz postgres flexible-server parameter set
.