fix: handle 404s gracefully in okta_push_group read, update, and delete - #2853
Open
exitcode0 wants to merge 1 commit into
Open
fix: handle 404s gracefully in okta_push_group read, update, and delete#2853exitcode0 wants to merge 1 commit into
exitcode0 wants to merge 1 commit into
Conversation
The okta_push_group resource discarded the API response on its read,
update, and delete calls, so a 404 from a mapping that was deleted out
of band surfaced as a hard error. This blocked `terraform plan`/`apply`
and `terraform destroy`, forcing manual `state rm` to recover.
Capture the V6 API response on each call and branch on a 404 via
utils.SuppressErrorOn404_V6:
- Read: remove the resource from state so Terraform plans a recreate.
- Update: remove the resource from state so Terraform plans a recreate.
- Delete: treat an already-gone mapping as a successful destroy (both
the INACTIVE deactivation and the delete call).
Mirrors the existing 404-handling patterns in
resource_okta_authenticator_webauthn_custom_aaguid.go (read) and
resource_okta_group_owners.go (update/delete).
Fixes okta#2807
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2807
Summary
okta_push_groupdiscarded the API response on its read, update, and delete calls (groupPushMapping, _, err := ...), so a404 Not Foundreturned for a mapping that was deleted out of band (e.g. removed in the Okta Admin UI) surfaced as a hard error. This blockedterraform plan/applyandterraform destroy, forcing a manualterraform state rmto recover.This mirrors the exact failure reported in #2807:
Changes
Capture the V6 API response on each call and branch on a 404 via
utils.SuppressErrorOn404_V6:resp.State.RemoveResource) so Terraform plans a recreate instead of erroring on refresh/plan.INACTIVEdeactivation call and the delete call.This matches the established 404-handling patterns already in the provider:
resource_okta_authenticator_webauthn_custom_aaguid.go(read →RemoveResource)resource_okta_group_owners.go(update/delete → suppress 404)Behavior change
Before:
404from an out-of-band-deleted mapping → hard error on plan/apply/destroy.After: Terraform detects the mapping is gone and plans a recreate (read/update) or completes the destroy cleanly (delete) — the behavior requested in #2807.