Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
fix(terraform): fix tf apply failures (#305)
Browse files Browse the repository at this point in the history
* fix(terraform): fix tf apply failures

* Link to GitHub issue

Co-authored-by: Dina Graves Portman <dinagraves@google.com>
  • Loading branch information
Ace Nassri and dinagraves committed Feb 3, 2022
1 parent 9565b9e commit d2943e0
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions terraform/ops/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,27 @@ resource "google_project_iam_member" "pubsub_publisher_iam_member" {
provider = google
role = "roles/pubsub.publisher"
member = "serviceAccount:${data.google_project.main.number}@cloudbuild.gserviceaccount.com"

depends_on = [
google_project_service.cloudbuild
]
}

###
# Container Hosting
##

resource "time_sleep" "wait_for_artifactregistry" {
depends_on = [google_project_service.artifactregistry]

# Artifact Registry API enablement is eventually consistent
# for brand-new GCP projects; we add a delay as a work-around.
#
# For more information, see this GitHub issue:
# https://github.com/hashicorp/terraform-provider-google/issues/11020
create_duration = "10s"
}

resource "google_artifact_registry_repository" "website_docker" {
format = "DOCKER"
location = var.region
Expand All @@ -59,8 +74,8 @@ resource "google_artifact_registry_repository" "website_docker" {
provider = google-beta

depends_on = [
# Need to enable Artifact Registry service before repository creation.
google_project_service.artifactregistry
# Need to ensure Artifact Registry API is enabled first.
time_sleep.wait_for_artifactregistry
]
}

Expand All @@ -72,8 +87,8 @@ resource "google_artifact_registry_repository" "api_docker" {
provider = google-beta

depends_on = [
# Need to enable Artifact Registry service before repository creation.
google_project_service.artifactregistry
# Need to ensure Artifact Registry API is enabled first.
time_sleep.wait_for_artifactregistry
]
}

Expand Down

0 comments on commit d2943e0

Please sign in to comment.