group_settings: remove from state on 404 instead of erroring during read#30
Open
akemner-figma wants to merge 2 commits into
Open
group_settings: remove from state on 404 instead of erroring during read#30akemner-figma wants to merge 2 commits into
akemner-figma wants to merge 2 commits into
Conversation
akemner-figma
added a commit
to akemner-figma/terraform-provider-googleworkspace
that referenced
this pull request
Jul 18, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
akemner-figma
added a commit
to akemner-figma/terraform-provider-googleworkspace
that referenced
this pull request
Jul 18, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
akemner-figma
force-pushed
the
fix-group-settings-404-remove-from-state
branch
from
July 18, 2026 23:49
7340359 to
fd148a0
Compare
When the underlying group is deleted outside Terraform, resourceGroupSettingsRead
returned the 404 as a fatal error, so plan/refresh failed and the resource was
never dropped from state — the only recovery was a manual `terraform state rm`.
Route the group Get 404 through handleNotFoundError (which does d.SetId("")),
matching the existing behavior of resource_group. Non-404 errors are unchanged.
Adds TestAccResourceGroupSettings_disappears covering out-of-band group deletion.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
akemner-figma
force-pushed
the
fix-group-settings-404-remove-from-state
branch
from
July 19, 2026 00:42
fd148a0 to
dfe19f9
Compare
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.
Problem
When the group underlying a
googleworkspace_group_settingsresource is deleted outside Terraform, the nextplan/refreshfails hard on the settings read:Because the resource is never dropped from state, the plan cannot proceed, and the only recovery is a manual
terraform state rm.Root cause
resourceGroupSettingsReadreturns the groupGeterror viadiag.FromErr(err)for every error, including a 404. The siblinggoogleworkspace_groupresource already handles this correctly by routing the same call throughhandleNotFoundError(which doesd.SetId("")and returns), butgroup_settingsdoes not.Fix
Route the group
Get404 inresourceGroupSettingsReadthroughhandleNotFoundError(err, d, d.Get("email").(string)), mirroringresourceGroupRead. Non-404 errors (and the localstrconv.ParseBoolerrors) are unchanged.Test
Adds
TestAccResourceGroupSettings_disappears: creates a group + settings, deletes the group out-of-band via the Directory API, and asserts the refresh drops the settings from state and yields a non-empty plan. Without the fix this step errors on the 404.Notes
Readshould remove a resource from state when it no longer exists;resource_groupin this provider already does so.