Skip to content

Commit

Permalink
fix: Updated the default value of the prefix input to be "dev" in the…
Browse files Browse the repository at this point in the history
… DA (#373)

Co-authored-by: Khuzaima-Shakeel <[email protected]>
  • Loading branch information
Khuzaima05 and Khuzaima-Shakeel authored Feb 14, 2025
1 parent c08c6a9 commit f5ff61c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
6 changes: 4 additions & 2 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
},
{
"key": "prefix",
"required": true
"required": true,
"description": "The prefix to add to all resources that this solution creates. To not use any prefix value, you can enter the string `__NULL__`."
},
{
"key": "use_existing_resource_group"
Expand Down Expand Up @@ -217,7 +218,8 @@
},
{
"key": "prefix",
"required": true
"required": true,
"description": "The prefix to add to all resources that this solution creates. To not use any prefix value, you can enter the string `__NULL__`."
},
{
"key": "use_existing_resource_group"
Expand Down
10 changes: 5 additions & 5 deletions solutions/enterprise/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,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.prefix}-${var.resource_group_name}" : var.resource_group_name) : null
resource_group_name = var.use_existing_resource_group == false ? try("${local.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
}

Expand All @@ -13,10 +13,10 @@ module "resource_group" {
#######################################################################################################################

locals {
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
create_new_kms_key = var.existing_kms_key_crn == null ? 1 : 0 # no need to create any KMS resources if passing an existing key
event_streams_key_name = var.prefix != null ? "${var.prefix}-${var.event_streams_key_name}" : var.event_streams_key_name
event_streams_key_ring_name = var.prefix != null ? "${var.prefix}-${var.event_streams_key_ring_name}" : var.event_streams_key_ring_name

event_streams_key_name = try("${local.prefix}-${var.event_streams_key_name}", var.event_streams_key_name)
event_streams_key_ring_name = try("${local.prefix}-${var.event_streams_key_ring_name}", var.event_streams_key_ring_name)
# tflint-ignore: terraform_unused_declarations
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
}
Expand Down Expand Up @@ -145,7 +145,7 @@ resource "time_sleep" "wait_for_authorization_policy" {
module "event_streams" {
source = "../../modules/fscloud"
resource_group_id = module.resource_group.resource_group_id
es_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.event_streams_name}" : var.event_streams_name
es_name = try("${local.prefix}-${var.event_streams_name}", var.event_streams_name)
kms_key_crn = local.kms_key_crn
schemas = var.schemas
region = var.region
Expand Down
2 changes: 1 addition & 1 deletion solutions/enterprise/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ variable "region" {

variable "prefix" {
type = string
description = "Optional. The prefix to append to all resources that this solution creates. Prefix is ignored if it is `null` or empty string (\"\")."
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."
default = "enterprise"
}

Expand Down
8 changes: 6 additions & 2 deletions solutions/quickstart/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
locals {
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
}

#######################################################################################################################
# Resource Group
#######################################################################################################################
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.prefix}-${var.resource_group_name}" : var.resource_group_name) : null
resource_group_name = var.use_existing_resource_group == false ? try("${local.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
}

Expand All @@ -14,7 +18,7 @@ module "resource_group" {
module "event_streams" {
source = "../../"
resource_group_id = module.resource_group.resource_group_id
es_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.es_name}" : var.es_name
es_name = try("${local.prefix}-${var.es_name}", var.es_name)
plan = var.plan
region = var.region
topics = var.topics
Expand Down
2 changes: 1 addition & 1 deletion solutions/quickstart/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "ibmcloud_api_key" {

variable "prefix" {
type = string
description = "Optional. The prefix to append to all resources that this solution creates. Prefix is ignored if it is `null` or empty string (\"\")."
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."
default = "dev"
}

Expand Down

0 comments on commit f5ff61c

Please sign in to comment.