Skip to content

Commit

Permalink
Add a delay between discovered resource fetch and forwarding rule cre…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
Krishnan Gopal committed Mar 12, 2024
1 parent e5d3c9d commit f12b980
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ data "google_apphub_discovered_service" "catalog-service" {
provider = google
location = "us-east1"
service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}"
depends_on = [google_apphub_service_project_attachment.service_project_attachment]
depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion]
}

resource "time_sleep" "wait_120s_for_resource_ingestion" {
depends_on = [google_compute_forwarding_rule.forwarding_rule]
create_duration = "120s"
}

resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" {
Expand Down
7 changes: 6 additions & 1 deletion mmv1/templates/terraform/examples/apphub_service_full.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ data "google_apphub_discovered_service" "catalog-service" {
provider = google
location = "us-east1"
service_uri = "//compute.googleapis.com/${google_compute_forwarding_rule.forwarding_rule.id}"
depends_on = [google_apphub_service_project_attachment.service_project_attachment]
depends_on = [google_apphub_service_project_attachment.service_project_attachment, time_sleep.wait_120s_for_resource_ingestion]
}

resource "time_sleep" "wait_120s_for_resource_ingestion" {
depends_on = [google_compute_forwarding_rule.forwarding_rule]
create_duration = "120s"
}

resource "google_apphub_service" "<%= ctx[:primary_resource_id] %>" {
Expand Down

0 comments on commit f12b980

Please sign in to comment.