Skip to content

Commit

Permalink
Update main.tf
Browse files Browse the repository at this point in the history
[Fix] Failed to recreate APigee organisation in the same Project
apigee#155
  • Loading branch information
mhdjomaa3450 authored Sep 2, 2024
1 parent fe6612a commit 51b4d28
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/apigee-x-core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ resource "google_project_service_identity" "apigee_sa" {
service = "apigee.googleapis.com"
}



resource "random_string" "key_random_suffix" {
length = 6
special = false
}


module "kms-org-db" {
source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms?ref=v28.0.0"
project_id = var.project_id
Expand All @@ -39,7 +47,8 @@ module "kms-org-db" {
}
keyring = {
location = coalesce(var.org_kms_keyring_location, var.ax_region)
name = var.org_kms_keyring_name

name = "${var.org_kms_keyring_name}-${random_string.key_random_suffix.result}"
}
keyring_create = var.org_kms_keyring_create
keys = {
Expand All @@ -56,7 +65,8 @@ module "kms-inst-disk" {
}
keyring = {
location = coalesce(each.value.keyring_location, each.value.region)
name = coalesce(each.value.keyring_name, "apigee-${each.key}")
name = "${coalesce(each.value.keyring_name, "apigee-${each.key}")}-${random_string.key_random_suffix.result}"

}
keyring_create = each.value.keyring_create
keys = {
Expand Down

0 comments on commit 51b4d28

Please sign in to comment.