fix: idempotent lifecycle ops#1303
Conversation
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
Hello, is there anything I can do to help move this PR forward? Such as creating a Issue to link to it? |
|
Hello, |
|
Hi @DominikPildner! We see the same behavior with SKE. Does this PR fix this aswell implicitly? I cannot see any SKE-Code touched. |
|
@karawedi good point, for the 404 Code check I only covered resources that I used in my tests. I now tried to find all similar places and applied the same fix. This depends on the API actually returning 404 though, which I did not test for the new changes. |
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
|
waiting for review |
|
Hi @DominikPildner, don't know how to make a suggestion here to an unchanged file. |
|
Thanks for your contribution! Hint for 2nd review: |
|
Thanks for the feedback, all requested changes were implemented. |
|
Hi @DominikPildner, |
|
@cgoetz-inovex I have resolved the conflicts. Seems the option to grant maintainers access is not available for organization repos. |
|
@DominikPildner , would it the be ok for you if I copy your commits into a branch on this repo? |
marceljk
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
404 checks added in Delete methods: - authorization/customrole/resource.go - edgecloud/instance/resource.go - logs/accesstoken/resource.go - logs/instance/resource.go - scf/organization/resource.go - serverbackup/schedule/resource.go and serverbackup/enable/resource.go - serverupdate/schedule/resource.go and serverupdate/enable/resource.go - sfs/export-policy/resource.go, sfs/resourcepool/resource.go, sfs/share/resource.go Other fixes: - iaas/networkarea/resource.go treat 400 as already-deleted - loadbalancer/observability-credential/resource.go added empty credentialsRef guard in Read
|
All requested changes implemented. 404 checks added in Delete methods:
Other fixes:
|
marceljk
left a comment
There was a problem hiding this comment.
Thanks for the update. Looks good to me and can be merged
|
thanks for you contribution, merged! |
Description
Issue: #1338
This PR brings resource lifecycle operations in line with Terraform plugin framework best practices (see Read and Delete guidelines), to fix handling of missing resources:
Read with missing ID: When
Readis called beforeCreate(e.g. by tools that observe existing infrastructure), resource IDs that are server-assigned will be empty. Previously this caused API errors from requests with empty IDs. Now the resource is gracefully removed from state instead.Delete of already-deleted resource: When a resource has already been deleted outside of Terraform,
Deletenow handles the not-found response gracefully instead of returning an error.Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)