Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroying a google_cloud_identity_group resource that has at least one OWNER member fails #7617

Open
sruffilli opened this issue Oct 23, 2020 · 5 comments
Labels
forward/linked persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work service/cloudidentity-groups
Milestone

Comments

@sruffilli
Copy link

sruffilli commented Oct 23, 2020

Terraform Version

$ terraform -v
Terraform v0.13.4

Affected Resource(s)

  • google_cloud_identity_group
  • google_cloud_identity_group_membership

Terraform Configuration Files (if applicable)

resource "google_cloud_identity_group" "group" {
  provider     = google-beta
  display_name = "google_cloud_identity_group test"

  parent = "customers/CXXXXXXXX"

  group_key {
    id = "[email protected]"
  }

  labels = {
    "cloudidentity.googleapis.com/groups.discussion_forum" = ""
  }
}

resource "google_cloud_identity_group_membership" "group_memberships" {
  provider = google-beta
  group    = google_cloud_identity_group.group.id

  member_key {
    id = "[email protected]"
  }

  roles {
    name = "MEMBER"
  }

  roles {
    name = "OWNER"
  }

}

Issue Description

Destroying a group that has at least one OWNER member fails with the following error

Error: Error when reading or editing GroupMembership: googleapi: Error 400: Error(4007): Cannot remove the OWNER role in membership 'groups/xxxxxxxxxxxxxx/memberships/NNNNNNNNNNNNNNNNNN' becuase it's the last OWNER role in the Google Groups.

This happens because terraform tries to deprovision all the google_cloud_identity_group_membership resources that depend on google_cloud_identity_group first - however APIs prevent deleting the last OWNER member. Note that this doesn't happen if a group has no OWNER members.

b/374162521

@edwardmedia edwardmedia self-assigned this Oct 23, 2020
@edwardmedia
Copy link
Contributor

@sruffilli the error message seems clear. It is blocked by API. The provider has nothing to do with it. To workaround, can you update the role to non OWNER first and then apply destroy?

@sruffilli
Copy link
Author

APIs prevent the last OWNER of a group to be downgraded or deleted.
I'm wondering whether it's possible, when destroying a group, to avoid deleting the memberships (which would be effectively deleted when the group gets deleted).

@ghost ghost removed waiting-response labels Oct 26, 2020
@edwardmedia
Copy link
Contributor

Let's see if there is anything the provider can do to match the API's behavior

@nat-henderson
Copy link
Contributor

Similar to #7616, this resource is not implemented as well as it could be - it seems there were some API changes since we implemented it. We should revisit this entire resource.

@nat-henderson nat-henderson added the persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work label Oct 29, 2020
@nat-henderson nat-henderson added this to the Goals milestone Nov 30, 2020
@stevenproctor
Copy link

I see GoogleCloudPlatform/cloud-foundation-fabric#182 referenced above was merged 18 days ago this comment.

What would the timing be for this to be taken advantage of by this provider, to know what version would need to be targeted to get this working.

@rileykarson rileykarson removed the bug label Mar 6, 2023
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Apr 6, 2023
…ce agent (hashicorp#7617)

* Update tests to use bootstrapped crypto permissions for compute service agent

* Fix templates

* Fix one more template

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit that referenced this issue Apr 6, 2023
…ce agent (#7617) (#14243)

* Update tests to use bootstrapped crypto permissions for compute service agent

* Fix templates

* Fix one more template

Signed-off-by: Modular Magician <[email protected]>
@github-actions github-actions bot added forward/review In review; remove label to forward service/cloudidentity-groups labels Oct 25, 2023
@melinath melinath removed the forward/review In review; remove label to forward label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forward/linked persistent-bug Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work service/cloudidentity-groups
Projects
None yet
Development

No branches or pull requests

7 participants