diff --git a/ibm_catalog.json b/ibm_catalog.json index f2dec868..60fd5cc8 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -128,7 +128,9 @@ "key": "resource_group_name" }, { - "key": "prefix" + "key": "prefix", + "required": true, + "description":"Prefix to add to all resources created by this solution. To not use any prefix value, you can enter the string `__NULL__`." }, { "key": "name" diff --git a/solutions/standard/main.tf b/solutions/standard/main.tf index d823f798..39e3055a 100644 --- a/solutions/standard/main.tf +++ b/solutions/standard/main.tf @@ -5,7 +5,7 @@ module "resource_group" { source = "terraform-ibm-modules/resource-group/ibm" version = "1.1.6" - resource_group_name = var.use_existing_resource_group == false ? (var.prefix != null ? "${var.prefix}-${var.resource_group_name}" : var.resource_group_name) : null + resource_group_name = var.use_existing_resource_group == false ? ((var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.resource_group_name}" : var.resource_group_name) : null existing_resource_group_name = var.use_existing_resource_group == true ? var.resource_group_name : null } @@ -29,8 +29,8 @@ locals { locals { create_new_kms_key = !var.use_ibm_owned_encryption_key && var.existing_kms_key_crn == null ? true : false # no need to create any KMS resources if passing an existing key, or using IBM owned keys - postgres_key_name = var.prefix != null ? "${var.prefix}-${var.key_name}" : var.key_name - postgres_key_ring_name = var.prefix != null ? "${var.prefix}-${var.key_ring_name}" : var.key_ring_name + postgres_key_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.key_name}" : var.key_name + postgres_key_ring_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.key_ring_name}" : var.key_ring_name } module "kms" { @@ -246,7 +246,7 @@ module "postgresql_db" { source = "../../modules/fscloud" depends_on = [time_sleep.wait_for_authorization_policy, time_sleep.wait_for_backup_kms_authorization_policy] resource_group_id = module.resource_group.resource_group_id - name = var.prefix != null ? "${var.prefix}-${var.name}" : var.name + name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.name}" : var.name region = var.region remote_leader_crn = var.remote_leader_crn skip_iam_authorization_policy = var.skip_pg_kms_auth_policy diff --git a/solutions/standard/variables.tf b/solutions/standard/variables.tf index 773bdc47..7dfdd084 100644 --- a/solutions/standard/variables.tf +++ b/solutions/standard/variables.tf @@ -32,8 +32,8 @@ variable "resource_group_name" { variable "prefix" { type = string - description = "Prefix to add to all resources created by this solution." - default = null + description = "Prefix to add to all resources created by this solution. To not use any prefix value, you can set this value to `null` or an empty string." + default = "postgresql" } variable "name" {