Skip to content

Commit 0f180bb

Browse files
fix: updated the default value of the prefix input to be "dev" in the DA.<br>- Marked the input as required in catalog so it will now show in the required tab of the projects UI.<br>-It is still possible omit the prefix by passing a value of null or empty string ("") when working directly with the terraform code, or by passing the string value of __NULL__ when deploying in projects or schematics. (#22)
1 parent 755197f commit 0f180bb

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

ibm_catalog.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@
8282
"default_value": "us-east"
8383
},
8484
{
85-
"key": "prefix"
85+
"key": "prefix",
86+
"required": true,
87+
"description": "The prefix to add to all resources that this solution creates. To not use any prefix value, you can enter the string `__NULL__`."
8688
},
8789
{
8890
"key": "db2_instance_name",

solutions/standard/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module "resource_group" {
66
source = "terraform-ibm-modules/resource-group/ibm"
77
version = "1.1.6"
8-
resource_group_name = var.use_existing_resource_group == false ? (var.prefix != null ? "${var.prefix}-${var.resource_group_name}" : var.resource_group_name) : null
8+
resource_group_name = var.use_existing_resource_group == false ? (try("${local.prefix}-${var.resource_group_name}", var.resource_group_name)) : null
99
existing_resource_group_name = var.use_existing_resource_group == true ? var.resource_group_name : null
1010
}
1111

@@ -27,6 +27,7 @@ data "ibm_sm_arbitrary_secret" "sm_subscription_id" {
2727
locals {
2828
sm_region = var.subscription_id_secret_crn != null ? module.crn_parser_subid[0].region : ""
2929
subscription_id = var.subscription_id_secret_crn != null ? data.ibm_sm_arbitrary_secret.sm_subscription_id[0].payload : (var.subscription_id != null ? var.subscription_id : null)
30+
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
3031
}
3132

3233
########################################################################################################################
@@ -36,7 +37,7 @@ locals {
3637
module "db2_instance" {
3738
source = "../.."
3839
region = var.region
39-
db2_instance_name = try("${var.prefix}-${var.db2_instance_name}", var.db2_instance_name)
40+
db2_instance_name = try("${local.prefix}-${var.db2_instance_name}", var.db2_instance_name)
4041
subscription_id = local.subscription_id
4142
resource_group_id = module.resource_group.resource_group_id
4243
service_endpoints = "private"

solutions/standard/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ variable "region" {
2727

2828
variable "prefix" {
2929
type = string
30-
description = "Prefix to append to all resources created by this example"
31-
default = null
30+
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."
31+
default = "dev"
3232
}
3333

3434
variable "use_existing_resource_group" {

0 commit comments

Comments
 (0)