Skip to content

Commit f5ff61c

Browse files
Khuzaima05Khuzaima-Shakeel
and
Khuzaima-Shakeel
authoredFeb 14, 2025··
fix: Updated the default value of the prefix input to be "dev" in the DA (#373)
Co-authored-by: Khuzaima-Shakeel <Khuzaima.Shakeel@ibm.com>
1 parent c08c6a9 commit f5ff61c

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed
 

‎ibm_catalog.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
},
6565
{
6666
"key": "prefix",
67-
"required": true
67+
"required": true,
68+
"description": "The prefix to add to all resources that this solution creates. To not use any prefix value, you can enter the string `__NULL__`."
6869
},
6970
{
7071
"key": "use_existing_resource_group"
@@ -217,7 +218,8 @@
217218
},
218219
{
219220
"key": "prefix",
220-
"required": true
221+
"required": true,
222+
"description": "The prefix to add to all resources that this solution creates. To not use any prefix value, you can enter the string `__NULL__`."
221223
},
222224
{
223225
"key": "use_existing_resource_group"

‎solutions/enterprise/main.tf

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module "resource_group" {
55
source = "terraform-ibm-modules/resource-group/ibm"
66
version = "1.1.6"
7-
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
7+
resource_group_name = var.use_existing_resource_group == false ? try("${local.prefix}-${var.resource_group_name}", var.resource_group_name) : null
88
existing_resource_group_name = var.use_existing_resource_group == true ? var.resource_group_name : null
99
}
1010

@@ -13,10 +13,10 @@ module "resource_group" {
1313
#######################################################################################################################
1414

1515
locals {
16+
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
1617
create_new_kms_key = var.existing_kms_key_crn == null ? 1 : 0 # no need to create any KMS resources if passing an existing key
17-
event_streams_key_name = var.prefix != null ? "${var.prefix}-${var.event_streams_key_name}" : var.event_streams_key_name
18-
event_streams_key_ring_name = var.prefix != null ? "${var.prefix}-${var.event_streams_key_ring_name}" : var.event_streams_key_ring_name
19-
18+
event_streams_key_name = try("${local.prefix}-${var.event_streams_key_name}", var.event_streams_key_name)
19+
event_streams_key_ring_name = try("${local.prefix}-${var.event_streams_key_ring_name}", var.event_streams_key_ring_name)
2020
# tflint-ignore: terraform_unused_declarations
2121
validate_kms = var.existing_kms_instance_crn == null && var.existing_kms_key_crn == null ? tobool("Both 'existing_kms_instance_crn' and 'existing_kms_key_crn' input variables can not be null. Set 'existing_kms_instance_crn' to create a new KMS key or 'existing_kms_key_crn' to use an existing KMS key.") : true
2222
}
@@ -145,7 +145,7 @@ resource "time_sleep" "wait_for_authorization_policy" {
145145
module "event_streams" {
146146
source = "../../modules/fscloud"
147147
resource_group_id = module.resource_group.resource_group_id
148-
es_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.event_streams_name}" : var.event_streams_name
148+
es_name = try("${local.prefix}-${var.event_streams_name}", var.event_streams_name)
149149
kms_key_crn = local.kms_key_crn
150150
schemas = var.schemas
151151
region = var.region

‎solutions/enterprise/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variable "region" {
1212

1313
variable "prefix" {
1414
type = string
15-
description = "Optional. The prefix to append to all resources that this solution creates. Prefix is ignored if it is `null` or empty string (\"\")."
15+
description = "The prefix to add to all resources that this solution creates. To not use any prefix value, you can set this value to `null` or an empty string."
1616
default = "enterprise"
1717
}
1818

‎solutions/quickstart/main.tf

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
locals {
2+
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
3+
}
4+
15
#######################################################################################################################
26
# Resource Group
37
#######################################################################################################################
48
module "resource_group" {
59
source = "terraform-ibm-modules/resource-group/ibm"
610
version = "1.1.6"
7-
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
11+
resource_group_name = var.use_existing_resource_group == false ? try("${local.prefix}-${var.resource_group_name}", var.resource_group_name) : null
812
existing_resource_group_name = var.use_existing_resource_group == true ? var.resource_group_name : null
913
}
1014

@@ -14,7 +18,7 @@ module "resource_group" {
1418
module "event_streams" {
1519
source = "../../"
1620
resource_group_id = module.resource_group.resource_group_id
17-
es_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.es_name}" : var.es_name
21+
es_name = try("${local.prefix}-${var.es_name}", var.es_name)
1822
plan = var.plan
1923
region = var.region
2024
topics = var.topics

‎solutions/quickstart/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variable "ibmcloud_api_key" {
66

77
variable "prefix" {
88
type = string
9-
description = "Optional. The prefix to append to all resources that this solution creates. Prefix is ignored if it is `null` or empty string (\"\")."
9+
description = "The prefix to add to all resources that this solution creates. To not use any prefix value, you can set this value to `null` or an empty string."
1010
default = "dev"
1111
}
1212

0 commit comments

Comments
 (0)
Please sign in to comment.