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

Fix a race condition when creating a new G Suite group #141

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

thefirstofthe300
Copy link
Contributor

When a new G Suite group is created to manage a project, core_project_factory would attempt to assign the group IAM permissions before the group was finished being created by the gsuite_enabled module. To fix this condition, an implicit dependency was added to the Terraform using the email attribute from the gsuite_group resource.

Also, the google_compute_default_service_account resource depends on the Compute Engine API being enabled so it is possible for the fetch of the data resource to fail because it attempts to query the Compute Engine API before it is fully enabled. Adding an explicit dependency on the services being enabled fixes this issue.

modules/gsuite_enabled/main.tf Outdated Show resolved Hide resolved
When a new G Suite group is created to manage a project, `core_project_factory`
would attempt to assign the group IAM permissions before the group was
finished being created by the `gsuite_enabled` module. To fix this condition,
an implicit dependency was added to the Terraform using the email attribute
from the `gsuite_group` resource.

Also, the `google_compute_default_service_account` resource depends on the
Compute Engine API being enabled so it is possible for the fetch of the data
resource to fail because it attempts to query the Compute Engine API before it
is fully enabled. Adding an explicit dependency on the services being enabled
fixes this issue.
@morgante morgante merged commit edd458f into terraform-google-modules:master Feb 21, 2019
thefirstofthe300 added a commit to thefirstofthe300/terraform-google-project-factory that referenced this pull request Feb 27, 2019
The default service account data resource currently uses a depends_on
flag added to prevent a race condition in
terraform-google-modules#141

Due to the way that Terraform refreshes data resources, Terraform thinks
that the data resource has changed when in actuality it hasn't:
hashicorp/terraform#11806 (comment)

By changing to use a null data resource that interpolates the default
service account email, the data resource will only change when the project
number does.
thefirstofthe300 added a commit to thefirstofthe300/terraform-google-project-factory that referenced this pull request Feb 27, 2019
The default service account data resource currently uses a depends_on
flag added to prevent a race condition in
terraform-google-modules#141

Due to the way that Terraform refreshes data resources, Terraform thinks
that the data resource has changed when in actuality it hasn't:
hashicorp/terraform#11806 (comment)

By changing to use a null data resource that interpolates the default
service account email, the data resource will only change when the project
number does.
thefirstofthe300 added a commit to thefirstofthe300/terraform-google-project-factory that referenced this pull request Feb 28, 2019
The default service account data resource currently uses a depends_on
flag added to prevent a race condition in
terraform-google-modules#141

Due to the way that Terraform refreshes data resources, Terraform thinks
that the data resource has changed when in actuality it hasn't:
hashicorp/terraform#11806 (comment)

By changing to use a null data resource that interpolates the default
service account email, the data resource will only change when the project
number does.
thefirstofthe300 added a commit to thefirstofthe300/terraform-google-project-factory that referenced this pull request Feb 28, 2019
The default service account data resource currently uses a depends_on
flag added to prevent a race condition in
terraform-google-modules#141

Due to the way that Terraform refreshes data resources, Terraform thinks
that the data resource has changed when in actuality it hasn't:
hashicorp/terraform#11806 (comment)

By changing to use a null data resource that interpolates the default
service account email, the data resource will only change when the project
number does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants