Skip to content

Commit dd1c0b8

Browse files
authored
Merge branch 'main' into kibana_enpoint
2 parents 4e01a9f + 51a6d7e commit dd1c0b8

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

ibm_catalog.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@
117117
"key": "resource_group_name"
118118
},
119119
{
120-
"key": "prefix"
120+
"key": "prefix",
121+
"required": true,
122+
"description": "Prefix to add to all resources created by this solution. To not use any prefix value, you can enter the string `__NULL__`."
121123
},
122124
{
123125
"key": "region",

solutions/standard/main.tf

Lines changed: 8 additions & 8 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 ? ((var.prefix != null && var.prefix != "") ? "${var.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

@@ -29,8 +29,8 @@ locals {
2929

3030
locals {
3131
create_new_kms_key = var.existing_db_instance_crn == null && !var.use_ibm_owned_encryption_key && var.existing_kms_key_crn == null ? 1 : 0 # no need to create any KMS resources if using existing Elasticsearch, passing an existing key, or using IBM owned keys
32-
elasticsearch_key_name = var.prefix != null ? "${var.prefix}-${var.elasticsearch_key_name}" : var.elasticsearch_key_name
33-
elasticsearch_key_ring_name = var.prefix != null ? "${var.prefix}-${var.elasticsearch_key_ring_name}" : var.elasticsearch_key_ring_name
32+
elasticsearch_key_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.elasticsearch_key_name}" : var.elasticsearch_key_name
33+
elasticsearch_key_ring_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.elasticsearch_key_ring_name}" : var.elasticsearch_key_ring_name
3434
}
3535

3636
module "kms" {
@@ -292,7 +292,7 @@ module "elasticsearch" {
292292
source = "../../modules/fscloud"
293293
depends_on = [time_sleep.wait_for_authorization_policy, time_sleep.wait_for_backup_kms_authorization_policy]
294294
resource_group_id = module.resource_group.resource_group_id
295-
name = var.prefix != null ? "${var.prefix}-${var.name}" : var.name
295+
name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-${var.name}" : var.name
296296
region = var.region
297297
plan = var.plan
298298
skip_iam_authorization_policy = var.skip_es_kms_auth_policy
@@ -398,10 +398,10 @@ locals {
398398

399399
# Build the structure of the arbitrary credential type secret for admin password
400400
admin_pass_secret = [{
401-
secret_group_name = var.prefix != null && var.admin_pass_sm_secret_group != null ? "${var.prefix}-${var.admin_pass_sm_secret_group}" : var.admin_pass_sm_secret_group
401+
secret_group_name = (var.prefix != null && var.prefix != "") && var.admin_pass_sm_secret_group != null ? "${var.prefix}-${var.admin_pass_sm_secret_group}" : var.admin_pass_sm_secret_group
402402
existing_secret_group = var.use_existing_admin_pass_sm_secret_group
403403
secrets = [{
404-
secret_name = var.prefix != null && var.admin_pass_sm_secret_name != null ? "${var.prefix}-${var.admin_pass_sm_secret_name}" : var.admin_pass_sm_secret_name
404+
secret_name = (var.prefix != null && var.prefix != "") && var.admin_pass_sm_secret_name != null ? "${var.prefix}-${var.admin_pass_sm_secret_name}" : var.admin_pass_sm_secret_name
405405
secret_type = "arbitrary"
406406
secret_payload_password = local.admin_pass
407407
}
@@ -433,8 +433,8 @@ module "secrets_manager_service_credentials" {
433433

434434
locals {
435435
code_engine_project_id = var.existing_code_engine_project_id != null ? var.existing_code_engine_project_id : null
436-
code_engine_project_name = local.code_engine_project_id != null ? null : var.prefix != null ? "${var.prefix}-code-engine-kibana-project" : "ce-kibana-project"
437-
code_engine_app_name = var.prefix != null ? "${var.prefix}-kibana-app" : "ce-kibana-app"
436+
code_engine_project_name = local.code_engine_project_id != null ? null : (var.prefix != null && var.prefix != "") ? "${var.prefix}-code-engine-kibana-project" : "ce-kibana-project"
437+
code_engine_app_name = (var.prefix != null && var.prefix != "") ? "${var.prefix}-kibana-app" : "ce-kibana-app"
438438
kibana_version = var.enable_kibana_dashboard ? jsondecode(data.http.es_metadata[0].response_body).version.number : null
439439
}
440440

solutions/standard/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ variable "provider_visibility" {
2121

2222
variable "prefix" {
2323
type = string
24-
description = "Prefix to add to all resources created by this solution."
25-
default = null
24+
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."
25+
default = "dev"
2626
}
2727

2828
##############################################################################

0 commit comments

Comments
 (0)