Skip to content

Commit

Permalink
Update terraform to support terragrunt builder
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Aug 29, 2024
1 parent 31282a7 commit c9169da
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion deployment/modules/gcp/cloudbuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ terraform {
backend "gcs" {}
}

# This is the target registry for the terragrunt community builder image.
# Note that it needs to have location "us" rather than var.region as this
# is hard-coded in the builder config.
resource "google_artifact_registry_repository" "terragrunt" {
repository_id = "terragrunt"
location = "us"
description = "Terragrunt builder image"
format = "DOCKER"
}

data "google_compute_default_service_account" "default" {
}

resource "google_artifact_registry_repository_iam_binding" "binding" {
project = google_artifact_registry_repository.terragrunt.project
location = google_artifact_registry_repository.terragrunt.location
repository = google_artifact_registry_repository.terragrunt.name
role = "roles/artifactregistry.writer"
members = [
google_compute_default_service_account.default.member,
]
}

resource "google_artifact_registry_repository" "docker" {
repository_id = "docker-${var.env}"
location = var.region
Expand Down Expand Up @@ -82,7 +105,7 @@ resource "google_cloudbuild_trigger" "docker" {
// for instructions.
step {
id = "terraform_plan_all"
name = "cloud-builders-community/terragrunt"
name = "gcr.io/${var.project_id}/terragrunt"
args = ["plan-all"]
env = [
"TF_IN_AUTOMATION=1",
Expand Down

0 comments on commit c9169da

Please sign in to comment.