From ee544ed8ae41eeb39e643e2fd4ef948129f6e6aa Mon Sep 17 00:00:00 2001 From: Md Anam Raihan Date: Fri, 16 Aug 2024 17:21:31 +0530 Subject: [PATCH 1/5] fix: add prefix to en --- solutions/instances/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solutions/instances/main.tf b/solutions/instances/main.tf index 1578b718..6988075f 100644 --- a/solutions/instances/main.tf +++ b/solutions/instances/main.tf @@ -267,7 +267,7 @@ data "ibm_en_destinations" "en_destinations" { resource "ibm_en_topic" "en_topic" { count = var.existing_en_crn != null ? 1 : 0 instance_guid = local.existing_en_guid - name = "SCC Topic" + name = "${var.prefix} - SCC Topic" description = "Topic for SCC events routing" sources { id = local.scc_instance_crn @@ -281,7 +281,7 @@ resource "ibm_en_topic" "en_topic" { resource "ibm_en_subscription_email" "email_subscription" { count = var.existing_en_crn != null && length(var.scc_en_email_list) > 0 ? 1 : 0 instance_guid = local.existing_en_guid - name = "Email for Security and Compliance Center Subscription" + name = "${var.prefix} - Email for Security and Compliance Center Subscription" description = "Subscription for Security and Compliance Center Events" destination_id = [for s in toset(data.ibm_en_destinations.en_destinations[count.index].destinations) : s.id if s.type == "smtp_ibm"][0] topic_id = ibm_en_topic.en_topic[count.index].topic_id From 259abcc65b153a9a0cf57bce706b4b624146cc5f Mon Sep 17 00:00:00 2001 From: Md Anam Raihan Date: Fri, 16 Aug 2024 20:19:35 +0530 Subject: [PATCH 2/5] fix: update tests --- tests/pr_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/pr_test.go b/tests/pr_test.go index 204ad92f..9cf12c85 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -240,6 +240,7 @@ func TestRunExistingResourcesInstances(t *testing.T) { ImplicitRequired: false, Region: region, TerraformVars: map[string]interface{}{ + "prefix": prefix, "cos_region": region, "scc_region": region, "resource_group_name": terraform.Output(t, existingTerraformOptions, "resource_group_name"), @@ -266,6 +267,7 @@ func TestRunExistingResourcesInstances(t *testing.T) { // Do not hard fail the test if the implicit destroy steps fail to allow a full destroy of resource to occur ImplicitRequired: false, TerraformVars: map[string]interface{}{ + "prefix": prefix, "cos_region": region, "scc_region": region, "resource_group_name": terraform.Output(t, existingTerraformOptions, "resource_group_name"), From 9ec9726230d5b1efb0b9062644b8175614a8f324 Mon Sep 17 00:00:00 2001 From: Md Anam Raihan Date: Wed, 21 Aug 2024 12:01:22 +0530 Subject: [PATCH 3/5] test: add prefix to upgrade test --- tests/pr_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pr_test.go b/tests/pr_test.go index 9cf12c85..a7096ba0 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -177,6 +177,7 @@ func TestRunUpgradeInstances(t *testing.T) { }) options.TerraformVars = map[string]interface{}{ + "prefix": options.Prefix, "resource_group_name": options.Prefix, "existing_kms_instance_crn": permanentResources["hpcs_south_crn"], "kms_endpoint_type": "public", From 58b3c1fcdc6d51a43f00c2b7a5032c9e6b0915cb Mon Sep 17 00:00:00 2001 From: Md Anam Raihan Date: Mon, 26 Aug 2024 18:30:20 +0530 Subject: [PATCH 4/5] fix: added local variable for en topic and email --- solutions/instances/main.tf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/solutions/instances/main.tf b/solutions/instances/main.tf index 6988075f..b02d5100 100644 --- a/solutions/instances/main.tf +++ b/solutions/instances/main.tf @@ -257,6 +257,8 @@ module "scc_wp" { locals { parsed_existing_en_instance_crn = var.existing_en_crn != null ? split(":", var.existing_en_crn) : [] existing_en_guid = length(local.parsed_existing_en_instance_crn) > 0 ? local.parsed_existing_en_instance_crn[7] : null + en_topic = var.prefix != null ? "${var.prefix} - SCC Topic" : "SCC Topic" + en_subscription_email = var.prefix != null ? "${var.prefix} - Email for Security and Compliance Center Subscription" : "Email for Security and Compliance Center Subscription" } data "ibm_en_destinations" "en_destinations" { @@ -267,7 +269,7 @@ data "ibm_en_destinations" "en_destinations" { resource "ibm_en_topic" "en_topic" { count = var.existing_en_crn != null ? 1 : 0 instance_guid = local.existing_en_guid - name = "${var.prefix} - SCC Topic" + name = local.en_topic description = "Topic for SCC events routing" sources { id = local.scc_instance_crn @@ -281,7 +283,7 @@ resource "ibm_en_topic" "en_topic" { resource "ibm_en_subscription_email" "email_subscription" { count = var.existing_en_crn != null && length(var.scc_en_email_list) > 0 ? 1 : 0 instance_guid = local.existing_en_guid - name = "${var.prefix} - Email for Security and Compliance Center Subscription" + name = local.en_subscription_email description = "Subscription for Security and Compliance Center Events" destination_id = [for s in toset(data.ibm_en_destinations.en_destinations[count.index].destinations) : s.id if s.type == "smtp_ibm"][0] topic_id = ibm_en_topic.en_topic[count.index].topic_id From 8270973455c96366d4a7cb782839bca07b86fa49 Mon Sep 17 00:00:00 2001 From: Md Anam Raihan Date: Mon, 26 Aug 2024 18:34:42 +0530 Subject: [PATCH 5/5] fix: indentation --- solutions/instances/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solutions/instances/main.tf b/solutions/instances/main.tf index b02d5100..b559aa7e 100644 --- a/solutions/instances/main.tf +++ b/solutions/instances/main.tf @@ -257,8 +257,8 @@ module "scc_wp" { locals { parsed_existing_en_instance_crn = var.existing_en_crn != null ? split(":", var.existing_en_crn) : [] existing_en_guid = length(local.parsed_existing_en_instance_crn) > 0 ? local.parsed_existing_en_instance_crn[7] : null - en_topic = var.prefix != null ? "${var.prefix} - SCC Topic" : "SCC Topic" - en_subscription_email = var.prefix != null ? "${var.prefix} - Email for Security and Compliance Center Subscription" : "Email for Security and Compliance Center Subscription" + en_topic = var.prefix != null ? "${var.prefix} - SCC Topic" : "SCC Topic" + en_subscription_email = var.prefix != null ? "${var.prefix} - Email for Security and Compliance Center Subscription" : "Email for Security and Compliance Center Subscription" } data "ibm_en_destinations" "en_destinations" {