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.
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
danielrbradley
left a comment
There was a problem hiding this comment.
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.
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) | |
| } |
| } | ||
|
|
||
| func IsSingleton(path string) bool { | ||
| if res, ok := featureLookup[path]; ok { |
There was a problem hiding this comment.
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:Configurationresource 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 thataztakes inaz postgres flexible-server parameter set.