terraform-google-modules / terraform-google-project-factory

Creates an opinionated Google Cloud project by using Shared VPC, IAM, and Google Cloud APIs
https://registry.terraform.io/modules/terraform-google-modules/project-factory/google
Apache License 2.0
825 stars 533 forks source link

Error with default service account create_ignore_already_exists #914

Closed eveggeberg-spins closed 3 months ago

eveggeberg-spins commented 3 months ago

TL;DR

The newly released 15.0.1 added the create_ignore_already_exists bug fix, but it is throwing the error: Error: googleapi: Error 400: Invalid field mask for ServiceAccount. Field mask paths cannot be empty., badRequest

Expected behavior

This to ignore already created service accounts

Observed behavior

when running terraform again, I received this error:

Error: googleapi: Error 400: Invalid field mask for ServiceAccount. Field mask paths cannot be empty., badRequest with module.project_factory.module.project-factory.google_service_account.default_service_account[0] on .terraform/modules/compute-projects.project_factory/modules/core_project_factory/main.tf line 145, in resource "google_service_account" "default_service_account":

resource "google_service_account" "default_service_account" {

Terraform Configuration

module "project_factory" {
  source                  = "terraform-google-modules/project-factory/google"
  version                 = "= 15.0.0"

  name                    = var.gcp_project_id
  org_id                  = var.gcp_org_id
  folder_id               = var.gcp_folder_id
  billing_account         = var.gcp_billing_account_id
  activate_apis           = var.activate_gcp_apis
  default_service_account = var.default_service_account 
  labels                  = local.labels 
  random_project_id       = var.random_project_id
  auto_create_network     = var.gcp_project_auto_create_default_network
}

Terraform Version

1.83

Additional information

No response

eveggeberg-spins commented 3 months ago

To provide more info, this was occurring using provider version 5.22.0 and was fixed in provider version 5.26.0. After updating the provider, the issue went away. Maybe add an advisory to the release?