hashicorp / terraform-provider-googleworkspace

Terraform Provider for Google Workspace
https://registry.terraform.io/providers/hashicorp/googleworkspace
Mozilla Public License 2.0
130 stars 58 forks source link

Occasional timeout when applying the `googleworkspace_group_member` resource #475

Open PatrickDale opened 6 months ago

PatrickDale commented 6 months ago

Terraform Version

v1.7.5

Affected Resource(s)

Terraform Configuration Files

resource "googleworkspace_group_member" "member" {
  group_id = "the-group-id"
  email    = "the-member-email"

  role              = "MEMBER"
  delivery_settings = "NONE"
  type              = "USER"
}

Expected Behavior

We would have expected the member to be added to the group.

Actual Behavior

Most of the time the member is added to the group, but sometimes we get the error message:

Error: timed out while waiting for group_member to be inserted

Even though we get this timeout error, the member is still added to the group but the googleworkspace_group_member.member is not updated in the Terraform state. To resolve this we have to manually import googleworkspace_group_member.member into the Terraform state.

Steps to Reproduce

Apply the Terraform configuration above with different members in the same group, and occasionally you'll see the timeout error pasted above.

Important Factoids

We are adding Google Service Agents to the Google group, but I don't think this is the core issue since we only see this error occasionally.

References

This is similar in behavior to: https://github.com/hashicorp/terraform-provider-googleworkspace/issues/387.

SamuZad commented 4 months ago

This is an issue relating to the google APIs eventual consistency, and how the provider handles the checks for said eventual consistency

I significantly improved this in my fork: https://registry.terraform.io/providers/SamuZad/googleworkspace/latest/docs

The specific commit can be found here: https://github.com/SamuZad/terraform-provider-googleworkspace/commit/86270a6628f23caaf7455909d686d8e58912d074

Since implementing this, timing out during this operation has gone away completely, with no other problems cropping up 🙂