Skip to content

Commit 1121fa2

Browse files
authored
fix: Include cloudkms.googleapis.com API to activate when encrypt_gcs_bucket_tfstate set to true (#302)
1 parent 7233b2c commit 1121fa2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ locals {
1919
generated_bucket_name = var.random_suffix == true ? format("%s-%s-%s", var.project_prefix, "tfstate", random_id.suffix.hex) : format("%s-%s", var.project_prefix, "tfstate")
2020
supplied_bucket_name = var.random_suffix == true ? format("%s-%s", var.state_bucket_name, random_id.suffix.hex) : var.state_bucket_name
2121
state_bucket_name = var.state_bucket_name != "" ? local.supplied_bucket_name : local.generated_bucket_name
22-
impersonation_apis = distinct(concat(var.activate_apis, ["serviceusage.googleapis.com", "iamcredentials.googleapis.com"]))
23-
activate_apis = var.sa_enable_impersonation == true ? local.impersonation_apis : var.activate_apis
22+
base_apis = distinct(concat(var.activate_apis, var.encrypt_gcs_bucket_tfstate ? ["cloudkms.googleapis.com"] : []))
23+
impersonation_apis = distinct(concat(local.base_apis, ["serviceusage.googleapis.com", "iamcredentials.googleapis.com"]))
24+
activate_apis = var.sa_enable_impersonation == true ? local.impersonation_apis : local.base_apis
2425
org_project_creators_tf_sa = var.create_terraform_sa ? ["serviceAccount:${google_service_account.org_terraform[0].email}"] : []
2526
org_project_creators = distinct(concat(var.org_project_creators, local.org_project_creators_tf_sa, ["group:${var.group_org_admins}"]))
2627
is_organization = var.parent_folder == "" ? true : false

0 commit comments

Comments
 (0)