Skip to content

Commit d6d8e3b

Browse files
authored
Update terraform script to use cloud run (#2006)
1 parent eb6413b commit d6d8e3b

2 files changed

Lines changed: 12 additions & 24 deletions

File tree

import-automation/terraform/main.tf

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ variable "region" {
4343
default = "us-central1"
4444
}
4545

46-
variable "github_owner" {
47-
description = "The owner of the GitHub repository"
48-
type = string
49-
default = "datacommonsorg"
50-
}
51-
52-
variable "github_repo_name" {
53-
description = "The name of the GitHub repository (data)"
54-
type = string
55-
default = "data"
56-
}
57-
58-
variable "github_repo_ingestion_name" {
59-
description = "The name of the GitHub repository (import)"
60-
type = string
61-
default = "import"
62-
}
63-
6446
variable "spanner_instance_id" {
6547
description = "Spanner Instance ID"
6648
type = string
@@ -91,6 +73,12 @@ variable "dc_api_key" {
9173
sensitive = true
9274
}
9375

76+
variable "artifact_registry_url" {
77+
description = "Artifact Registry URL for Cloud Run images"
78+
type = string
79+
default = "us-docker.pkg.dev/datcom-ci/gcr.io"
80+
}
81+
9482
# --- APIs ---
9583

9684
locals {
@@ -181,14 +169,14 @@ resource "google_storage_bucket" "mount_bucket" {
181169
# --- Cloud Functions ---
182170

183171
resource "google_cloud_run_v2_service" "ingestion_helper" {
184-
name = "spanner-ingestion-helper"
172+
name = "ingestion-helper-service"
185173
location = var.region
186174
project = var.project_id
187175

188176
template {
189177
service_account = google_service_account.automation_sa.email
190178
containers {
191-
image = "${var.region}-docker.pkg.dev/${var.project_id}/${google_artifact_registry_repository.automation_repo.repository_id}/spanner-ingestion-helper:latest"
179+
image = "${var.artifact_registry_url}/datacommons-ingestion-helper:latest"
192180
env {
193181
name = "PROJECT_ID"
194182
value = var.project_id
@@ -228,14 +216,14 @@ resource "google_cloud_run_v2_service" "ingestion_helper" {
228216
}
229217

230218
resource "google_cloud_run_v2_service" "import_helper" {
231-
name = "import-automation-helper"
219+
name = "import-helper-service"
232220
location = var.region
233221
project = var.project_id
234222

235223
template {
236224
service_account = google_service_account.automation_sa.email
237225
containers {
238-
image = "${var.region}-docker.pkg.dev/${var.project_id}/${google_artifact_registry_repository.automation_repo.repository_id}/import-automation-helper:latest"
226+
image = "${var.artifact_registry_url}/datacommons-import-helper:latest"
239227
env {
240228
name = "PROJECT_ID"
241229
value = var.project_id

import-automation/workflow/cloudbuild_main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ steps:
3434
# 1. Build and push helper images
3535
- id: 'build-ingestion-helper'
3636
name: 'gcr.io/cloud-builders/gcloud'
37-
args: ['builds', 'submit', 'ingestion-helper', '--config', 'ingestion-helper/cloudbuild.yaml', '--substitutions', '_PROJECT_ID=${_PROJECT_ID},_LOCATION=${_LOCATION},_AR_REPO_URL=${_AR_REPO_URL}']
37+
args: ['builds', 'submit', 'ingestion-helper', '--config', 'ingestion-helper/cloudbuild.yaml', '--substitutions', '_AR_REPO_URL=${_AR_REPO_URL}']
3838
dir: 'import-automation/workflow'
3939

4040
- id: 'build-import-helper'
4141
name: 'gcr.io/cloud-builders/gcloud'
42-
args: ['builds', 'submit', 'import-helper', '--config', 'import-helper/cloudbuild.yaml', '--substitutions', '_PROJECT_ID=${_PROJECT_ID},_LOCATION=${_LOCATION},_AR_REPO_URL=${_AR_REPO_URL}']
42+
args: ['builds', 'submit', 'import-helper', '--config', 'import-helper/cloudbuild.yaml', '--substitutions', '_AR_REPO_URL=${_AR_REPO_URL}']
4343
dir: 'import-automation/workflow'
4444

4545
# 2. Trigger Staging Build (Child)

0 commit comments

Comments
 (0)