Skip to content

Commit 2876761

Browse files
fix: Added a default prefix value to the DA (cos). NOTE: It is still supported to pass null (or __NULL__ if in projects / schematics) if you do not wan't to use any prefix (#812)
1 parent acd33fc commit 2876761

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ibm_catalog.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@
251251
},
252252
{
253253
"key":"instance_cbr_rules"
254+
},
255+
{
256+
"key":"prefix",
257+
"required":true,
258+
"description": "Prefix to add to all resources created by this solution. To not use any prefix value, you can enter the string `__NULL__`."
254259
}
255260
]
256261

solutions/instance/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module "resource_group" {
22
source = "terraform-ibm-modules/resource-group/ibm"
33
version = "1.1.6"
4-
resource_group_name = var.existing_resource_group == false ? (var.prefix != null ? "${var.prefix}-${var.resource_group_name}" : var.resource_group_name) : null
4+
resource_group_name = var.existing_resource_group == false ? ((var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.resource_group_name}" : var.resource_group_name) : null
55
existing_resource_group_name = var.existing_resource_group == true ? var.resource_group_name : null
66
}
77

88
module "cos" {
99
source = "../../modules/fscloud"
1010
resource_group_id = module.resource_group.resource_group_id
1111
create_cos_instance = true
12-
cos_instance_name = var.prefix != null ? "${var.prefix}-${var.cos_instance_name}" : var.cos_instance_name
12+
cos_instance_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.cos_instance_name}" : var.cos_instance_name
1313
resource_keys = var.resource_keys
1414
cos_plan = var.cos_plan
1515
cos_tags = var.cos_tags

solutions/instance/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ variable "ibmcloud_api_key" {
66

77
variable "prefix" {
88
type = string
9-
description = "(Optional) Prefix to append to all resources created by this solution."
10-
default = null
9+
description = "(Optional) 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."
10+
default = "cos"
1111
}
1212

1313
variable "existing_resource_group" {

0 commit comments

Comments
 (0)