Conversation
…ead/Delete
resourceGithubCustomPropertiesRead propagated any error from
GetCustomProperty verbatim, including a 404 for a property that no longer
exists. This breaks the standard Terraform "resource already gone" recovery
path: Read must call d.SetId("") and return nil when the remote resource
is confirmed absent, not return a hard error.
This left Read to poll a deleted resource and report the delete as still
failed until it was manually removed from state. The 404 also could be hit
right after a successful Delete call re-observes state, matching the pattern
already used in resource_github_repository_custom_property.go's Read (via
errors.AsType[*github.ErrorResponse] with StatusCode == 404).
Delete gets the same treatment: removing an already-removed property should
be a no-op, not an error, again mirroring the repository-scoped sibling.
Fixes integrations#3641
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
|
Thanks for opening a PR on this! This is already being addressed in https://github.com/integrations/terraform-provider-github/pull/3234/changes#diff-759376803bb14871b2470ba914f08b5604e1cc642ab3ce6a6d748ab8df5fc407R253-R257 |
|
Hello @deiga, the mentioned PR is open since February. I see that there is recent activity, but is there any chance to get this simple fix merged in advance? It is affecting us in production. |
Description
resourceGithubCustomPropertiesReadpropagated any error fromGetCustomPropertyverbatim, including a 404 for a property that no longer exists on GitHub. This breaks the standard Terraform "resource already gone" recovery convention:Readshould calld.SetId("")and returnnilwhen the remote resource is confirmed absent, not surface a hard error.In practice this means: once the underlying custom property is deleted (whether by
terraform destroy, an external actor, or any controller built on this provider that re-observes state after a delete), the nextReadnever converges - it keeps reporting a 404 as a reconcile error instead of confirming deletion.resourceGithubCustomPropertiesDeletehas the same gap: removing an already-removed property currently errors, instead of being treated as a no-op.Fix
Mirrors the handling already used by the repo-scoped sibling,
resource_github_repository_custom_property.go'sRead/Delete(errors.AsType[*github.ErrorResponse](err)withStatusCode == 404).Testing
go build ./github/...andgo vet ./github/...pass.Fixes #3641