fix(stages): only add sandbox SA when `sandbox` feature is enabled (#1391)

If you have the `project_factory` feature enabled, but not the `sandbox` feature (as it's not a requirement on your org), when doing a `terraform apply` on `1-resman` it raises this errors as it's expecting the wrong feature when creating the sandbox SA

```
│ Error: Invalid index
│ 
│   on branch-sandbox.tf line 68, in resource "google_organization_iam_member" "org_policy_admin_sandbox":
│   68:   member = module.branch-sandbox-sa.0.iam_email
│     ├────────────────
│     │ module.branch-sandbox-sa is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.
```
This commit is contained in:
Gustavo Valverde 2023-05-24 01:17:35 -04:00 committed by GitHub
parent d245088fa1
commit 00cac9148a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ module "branch-sandbox-sa" {
}
resource "google_organization_iam_member" "org_policy_admin_sandbox" {
count = var.fast_features.project_factory ? 1 : 0
count = var.fast_features.sandbox ? 1 : 0
org_id = var.organization.id
role = "roles/orgpolicy.policyAdmin"
member = module.branch-sandbox-sa.0.iam_email