From d953d5fdcef4712e9b6f29651eea3357880dd401 Mon Sep 17 00:00:00 2001 From: cloudneutral Date: Tue, 9 Dec 2025 09:45:32 +0800 Subject: [PATCH] Enable IAM API before creating GCP bootstrap service account --- .../gcp-cloud/bootstrap-iam/main.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/iac-template/terraform-hcl-standard/gcp-cloud/bootstrap-iam/main.tf b/iac-template/terraform-hcl-standard/gcp-cloud/bootstrap-iam/main.tf index 1ca2c18f..6cf9af81 100644 --- a/iac-template/terraform-hcl-standard/gcp-cloud/bootstrap-iam/main.tf +++ b/iac-template/terraform-hcl-standard/gcp-cloud/bootstrap-iam/main.tf @@ -28,10 +28,20 @@ variable "service_account_roles" { ] } +resource "google_project_service" "iam" { + project = var.project_id + service = "iam.googleapis.com" + + # Prevent accidental disablement of a core API when destroying the stack + disable_on_destroy = false +} + resource "google_service_account" "bootstrap" { account_id = var.service_account_id display_name = "Terraform Bootstrap" project = var.project_id + + depends_on = [google_project_service.iam] } resource "google_project_iam_member" "bootstrap" {