diff --git a/.gcb/builds/main.tf b/.gcb/builds/main.tf index 06033821ae..72e7ef20ee 100644 --- a/.gcb/builds/main.tf +++ b/.gcb/builds/main.tf @@ -18,6 +18,10 @@ terraform { source = "hashicorp/google" version = "~> 6.0.0" } + time = { + source = "hashicorp/time" + version = "~> 0.11.0" + } } } @@ -33,12 +37,24 @@ module "services" { project = var.project } +# Wait for services to be fully active before creating resources. +# Service enablement can take time to propagate. +resource "time_sleep" "wait_for_services" { + create_duration = "60s" + + triggers = { + services = join(",", module.services.services) + } + + depends_on = [module.services] +} + # Create the resources we will need to run integration tests on. module "resources" { source = "./resources" project = var.project region = var.region - depends_on = [module.services] + depends_on = [time_sleep.wait_for_services] } # Create the service account needed for GCB and grant it the necessary diff --git a/.gcb/builds/services/outputs.tf b/.gcb/builds/services/outputs.tf new file mode 100644 index 0000000000..153d2a9802 --- /dev/null +++ b/.gcb/builds/services/outputs.tf @@ -0,0 +1,35 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +output "services" { + value = [ + google_project_service.aiplatform.id, + google_project_service.bigquery.id, + google_project_service.compute.id, + google_project_service.cloudbuild.id, + google_project_service.cloudscheduler.id, + google_project_service.dns.id, + google_project_service.firestore.id, + google_project_service.kms.id, + google_project_service.language.id, + google_project_service.pubsub.id, + google_project_service.secretmanager.id, + google_project_service.workflows.id, + google_project_service.speech.id, + google_project_service.storage.id, + google_project_service.sqladmin.id, + google_project_service.telemetry.id, + google_project_service.cloudtrace.id, + ] +}