terraform-google-modules/terraform-google-service-accounts

Skipping over existing Service Accounts instead of hard fail

Closed this issue · 1 comments

When using this module and passing in a list of service account names the module will hard fail if the service account_id already exists in the project.
Is there a way to make it so it will "skip" over any existing Service accounts in the project?

e.g.
Passing input
names = ["account-A", "account-B"]

If "account-B" already exists in the project then this module will hard fail.

This causes conflict when we are testing this out on multiple code branches provisioning to the same dev project.

There's no way to skip over service accounts which already exist, either in Terraform or this module. It doesn't match the Terraform operating model.

I would recommend either:

  • Having different branches deploy to different projects
  • Using the same state file/GCS backend for different branches
  • Injecting a random suffix in the names you specify (based on the branch)