From fc5e9b3fa93378248e3abe8c655f3ace45942d36 Mon Sep 17 00:00:00 2001 From: Khuzaima-Shakeel Date: Wed, 20 Aug 2025 12:28:57 +0530 Subject: [PATCH 1/5] feat: added add-on test --- tests/go.mod | 2 +- tests/go.sum | 4 ++-- tests/pr_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/tests/go.mod b/tests/go.mod index 1f8aeee2..86de133d 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.0 require ( github.com/gruntwork-io/terratest v0.50.0 github.com/stretchr/testify v1.10.0 - github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11 + github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12 ) require ( diff --git a/tests/go.sum b/tests/go.sum index e9f95234..b68f61ef 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -295,8 +295,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11 h1:f8qp4xvv2ySGSadmd0xJw/3r5equ9eOLKj2J0Ux9CyE= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11/go.mod h1:2uu21nGEK+6saiBO6MVJNystf2Wm0BUIyiQmxTLM72U= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12 h1:c6/my1qhlnD7twSjZ66/1xsKQHu2OC9EF4rRQmsDKMU= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12/go.mod h1:6Wz8vnBelmRZxD5qjm5K4MpvPPWpoCWRPzG76j0B36g= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw= github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk= diff --git a/tests/pr_test.go b/tests/pr_test.go index b8645102..b7aa2607 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -15,7 +15,9 @@ import ( "github.com/gruntwork-io/terratest/modules/terraform" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common" + "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic" ) @@ -248,3 +250,47 @@ func TestRunAccountSettings(t *testing.T) { err := options.RunSchematicTest() assert.Nil(t, err, "This should not have errored") } + +func TestActivityTrackerDefaultConfiguration(t *testing.T) { + t.Parallel() + + options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ + Testing: t, + Prefix: "at-def", + ResourceGroup: resourceGroup, + QuietMode: true, // Suppress logs except on failure + }) + + options.AddonConfig = cloudinfo.NewAddonConfigTerraform( + options.Prefix, + "deploy-arch-ibm-activity-tracker", + "fully-configurable", + map[string]interface{}{ + "prefix": options.Prefix, + "region": validRegions[rand.Intn(len(validRegions))], + }, + ) + + err := options.RunAddonTest() + require.NoError(t, err) +} + +// TestDependencyPermutations runs dependency permutations for the Event Notifications and all its dependencies +func TestActivityTrackerDependencyPermutations(t *testing.T) { + options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ + Testing: t, + Prefix: "at-perm", + AddonConfig: cloudinfo.AddonConfig{ + OfferingName: "deploy-arch-ibm-activity-tracker", + OfferingFlavor: "fully-configurable", + Inputs: map[string]interface{}{ + "prefix": "at-perm", + "region": validRegions[rand.Intn(len(validRegions))], + "existing_resource_group_name": resourceGroup, + }, + }, + }) + + err := options.RunAddonPermutationTest() + assert.NoError(t, err, "Dependency permutation test should not fail") +} From 3afce5af56a2b470b01ffdf621621654350cdd71 Mon Sep 17 00:00:00 2001 From: Khuzaima-Shakeel Date: Fri, 22 Aug 2025 18:41:44 +0530 Subject: [PATCH 2/5] update terratest-wrapper version --- tests/go.mod | 2 +- tests/go.sum | 4 ++-- tests/pr_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/go.mod b/tests/go.mod index 86de133d..1f8aeee2 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.0 require ( github.com/gruntwork-io/terratest v0.50.0 github.com/stretchr/testify v1.10.0 - github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12 + github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11 ) require ( diff --git a/tests/go.sum b/tests/go.sum index b68f61ef..e9f95234 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -295,8 +295,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12 h1:c6/my1qhlnD7twSjZ66/1xsKQHu2OC9EF4rRQmsDKMU= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.12/go.mod h1:6Wz8vnBelmRZxD5qjm5K4MpvPPWpoCWRPzG76j0B36g= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11 h1:f8qp4xvv2ySGSadmd0xJw/3r5equ9eOLKj2J0Ux9CyE= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.58.11/go.mod h1:2uu21nGEK+6saiBO6MVJNystf2Wm0BUIyiQmxTLM72U= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw= github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk= diff --git a/tests/pr_test.go b/tests/pr_test.go index 79f954a6..3cfacc57 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -270,13 +270,13 @@ func TestActivityTrackerDefaultConfiguration(t *testing.T) { "region": validRegions[rand.Intn(len(validRegions))], }, ) - err := options.RunAddonTest() require.NoError(t, err) } // TestDependencyPermutations runs dependency permutations for the Event Notifications and all its dependencies func TestActivityTrackerDependencyPermutations(t *testing.T) { + t.Skip("Skipping dependency permutations until the test is fixed") options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ Testing: t, Prefix: "at-perm", From c3350d550faa7be3af0ceac22094a7a6bde04902 Mon Sep 17 00:00:00 2001 From: Khuzaima-Shakeel Date: Thu, 28 Aug 2025 11:40:51 +0530 Subject: [PATCH 3/5] update test --- common-dev-assets | 2 +- ibm_catalog.json | 26 +++++++++++++++++------ solutions/fully-configurable/main.tf | 2 +- solutions/fully-configurable/variables.tf | 2 +- tests/go.mod | 2 +- tests/go.sum | 4 ++-- tests/pr_test.go | 9 ++++---- 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/common-dev-assets b/common-dev-assets index 7179ae4f..abf631a1 160000 --- a/common-dev-assets +++ b/common-dev-assets @@ -1 +1 @@ -Subproject commit 7179ae4f3446b3816fa2d72c873f8f8e86797836 +Subproject commit abf631a16a48a308e609896937e1eed16b4aae4e diff --git a/ibm_catalog.json b/ibm_catalog.json index c8ea6e67..bf56364e 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -316,7 +316,9 @@ "description": "Enable this to create an IBM Cloud Object Storage(COS) instance. The buckets to store events will be created by the Activity Tracker Event Routing deployable architecture.", "id": "68921490-2778-4930-ac6d-bae7be6cd958-global", "version": "v10.2.1", - "flavors": ["instance"], + "flavors": [ + "instance" + ], "catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3", "optional": true, "on_by_default": true, @@ -346,7 +348,9 @@ "description": "Enable when you want to create your own managed keys to encrypt the buckets. Select only if existing KMS instance or Key is not provided. ", "id": "2cad4789-fa90-4886-9c9e-857081c273ee-global", "version": "v5.1.19", - "flavors": ["fully-configurable"], + "flavors": [ + "fully-configurable" + ], "catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3", "optional": true, "on_by_default": true, @@ -375,7 +379,9 @@ "name": "deploy-arch-ibm-cloud-logs", "description": "Enable this to create an IBM Cloud Logs (ICL) Instance which can be used for storage and analysis of events ingested by Activity Tracker. ", "catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3", - "flavors": ["fully-configurable"], + "flavors": [ + "fully-configurable" + ], "id": "63d8ae58-fbf3-41ce-b844-0fb5b85882ab-global", "version": "v1.6.11", "optional": true, @@ -406,7 +412,9 @@ "description": "Enable IBM Cloud Monitoring to gain operational visibility into your cloud storage buckets. ", "id": "73debdbf-894f-4c14-81c7-5ece3a70b67d-global", "version": "v1.6.4", - "flavors": ["fully-configurable"], + "flavors": [ + "fully-configurable" + ], "catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3", "optional": true, "on_by_default": true, @@ -444,7 +452,7 @@ "url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-activity-tracker/main/reference-architecture/activity-tracker.svg", "type": "image/svg+xml" }, - "description": "This architecture supports creating IBM Cloud Activity Tracker Event Routing target to an object storage bucket and cloud logs instance. You can provide an existing Cloud Object Storage (COS) instance or use [Cloud automation for Object Storage](https://cloud.ibm.com/catalog/7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3/architecture/deploy-arch-ibm-cos-68921490-2778-4930-ac6d-bae7be6cd958-global) dependency for creating COS instance. This architecutre will create object storage buckets inside the COS instance for storing the events ingested by Activity Tracker Event Routing.

In addition, it enables encryption for the object storage bucket by provisioning an IBM Key Protect service instance, where a Key Ring and associated key are created to manage encryption through IBM Cloud Key Management Services (KMS). You can choose to provide an existing KMS instance as well.

Additionally, you can use [Cloud automation for Cloud Logs](https://cloud.ibm.com/catalog/7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3/architecture/deploy-arch-ibm-cloud-logs-63d8ae58-fbf3-41ce-b844-0fb5b85882ab-global) to create a cloud logs instance or provide an existing cloud logs instance crn for setting it as event routing target. This architecture will automatically create the COS buckets to collect and store auditing events." + "description": "This architecture supports creating IBM Cloud Activity Tracker Event Routing target to an object storage bucket and cloud logs instance. You can provide an existing Cloud Object Storage (COS) instance or use [Cloud automation for Object Storage](https://cloud.ibm.com/catalog/7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3/architecture/deploy-arch-ibm-cos-68921490-2778-4930-ac6d-bae7be6cd958-global) dependency for creating COS instance. This architecture will create object storage buckets inside the COS instance for storing the events ingested by Activity Tracker Event Routing.

In addition, it enables encryption for the object storage bucket by provisioning an IBM Key Protect service instance, where a Key Ring and associated key are created to manage encryption through IBM Cloud Key Management Services (KMS). You can choose to provide an existing KMS instance as well.

Additionally, you can use [Cloud automation for Cloud Logs](https://cloud.ibm.com/catalog/7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3/architecture/deploy-arch-ibm-cloud-logs-63d8ae58-fbf3-41ce-b844-0fb5b85882ab-global) to create a cloud logs instance or provide an existing cloud logs instance crn for setting it as event routing target. This architecture will automatically create the COS buckets to collect and store auditing events." } ] } @@ -510,11 +518,15 @@ "iam_permissions": [ { "service_name": "All account management services", - "role_crns": ["crn:v1:bluemix:public:iam::::role:Administrator"] + "role_crns": [ + "crn:v1:bluemix:public:iam::::role:Administrator" + ] }, { "service_name": "atracker", - "role_crns": ["crn:v1:bluemix:public:iam::::role:Administrator"] + "role_crns": [ + "crn:v1:bluemix:public:iam::::role:Administrator" + ] } ], "architecture": { diff --git a/solutions/fully-configurable/main.tf b/solutions/fully-configurable/main.tf index 39a0603d..560987c5 100644 --- a/solutions/fully-configurable/main.tf +++ b/solutions/fully-configurable/main.tf @@ -134,7 +134,7 @@ resource "ibm_iam_authorization_policy" "atracker_cos" { # KMS Key ####################################################################################################################### -# If existing KMS intance CRN passed, parse details from it +# If existing KMS instance CRN passed, parse details from it module "kms_instance_crn_parser" { count = var.existing_kms_instance_crn != null ? 1 : 0 source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser" diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index ce04a551..a274bd27 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -221,7 +221,7 @@ variable "skip_cos_kms_auth_policy" { variable "skip_activity_tracker_cos_auth_policy" { type = bool - description = "To skip creating an IAM authorization policy that allows the Activity Traker to write to the Cloud Object Storage instance, set this variable to `true`." + description = "To skip creating an IAM authorization policy that allows the Activity Tracker to write to the Cloud Object Storage instance, set this variable to `true`." default = false } diff --git a/tests/go.mod b/tests/go.mod index 14e8589a..4f3c6990 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.0 require ( github.com/gruntwork-io/terratest v0.50.0 github.com/stretchr/testify v1.10.0 - github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1 + github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.3 ) require ( diff --git a/tests/go.sum b/tests/go.sum index 538a020c..43b5bb52 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -295,8 +295,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1 h1:9/uYvUFFLIH91F16AiJqP/LZeGi4t2CYtc8iz3bBXdQ= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1/go.mod h1:kdhZ+FeS71D+tB0E2Sh1ISD3zQ+RThPX5SyFqduo7G8= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.3 h1:Z5lZaaka8ilzOws9BrtJgmU4Kdt+ntVKWHnebMJUhvU= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.3/go.mod h1:kdhZ+FeS71D+tB0E2Sh1ISD3zQ+RThPX5SyFqduo7G8= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw= github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk= diff --git a/tests/pr_test.go b/tests/pr_test.go index 3cfacc57..a6cca536 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -256,7 +256,7 @@ func TestActivityTrackerDefaultConfiguration(t *testing.T) { options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ Testing: t, - Prefix: "at-def", + Prefix: "act-def", ResourceGroup: resourceGroup, QuietMode: true, // Suppress logs except on failure }) @@ -270,21 +270,20 @@ func TestActivityTrackerDefaultConfiguration(t *testing.T) { "region": validRegions[rand.Intn(len(validRegions))], }, ) + err := options.RunAddonTest() require.NoError(t, err) } -// TestDependencyPermutations runs dependency permutations for the Event Notifications and all its dependencies func TestActivityTrackerDependencyPermutations(t *testing.T) { - t.Skip("Skipping dependency permutations until the test is fixed") options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ Testing: t, - Prefix: "at-perm", + Prefix: "app-per", AddonConfig: cloudinfo.AddonConfig{ OfferingName: "deploy-arch-ibm-activity-tracker", OfferingFlavor: "fully-configurable", Inputs: map[string]interface{}{ - "prefix": "at-perm", + "prefix": "act-per", "region": validRegions[rand.Intn(len(validRegions))], "existing_resource_group_name": resourceGroup, }, From b17976a30bb60408b358d50476b5419357b4d49e Mon Sep 17 00:00:00 2001 From: Khuzaima-Shakeel Date: Thu, 4 Sep 2025 09:51:58 +0530 Subject: [PATCH 4/5] update PR --- ibm_catalog.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index bf56364e..fcf4897e 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -377,7 +377,7 @@ }, { "name": "deploy-arch-ibm-cloud-logs", - "description": "Enable this to create an IBM Cloud Logs (ICL) Instance which can be used for storage and analysis of events ingested by Activity Tracker. ", + "description": "Configure IBM Cloud Logs to analyse the platform logs.", "catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3", "flavors": [ "fully-configurable" @@ -409,7 +409,7 @@ }, { "name": "deploy-arch-ibm-cloud-monitoring", - "description": "Enable IBM Cloud Monitoring to gain operational visibility into your cloud storage buckets. ", + "description": "Configure IBM Cloud Monitoring to collect the platform metrics.", "id": "73debdbf-894f-4c14-81c7-5ece3a70b67d-global", "version": "v1.6.4", "flavors": [ From ead6610e75e25d1ae9f8f50337b291b615fb96ad Mon Sep 17 00:00:00 2001 From: Khuzaima Shakeel <56439894+Khuzaima05@users.noreply.github.com> Date: Thu, 4 Sep 2025 14:51:31 +0530 Subject: [PATCH 5/5] Update tests/pr_test.go Co-authored-by: Md Anam Raihan --- tests/pr_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pr_test.go b/tests/pr_test.go index adca0ee2..05b11dba 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -280,7 +280,7 @@ func TestActivityTrackerDependencyPermutations(t *testing.T) { t.Parallel() options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ Testing: t, - Prefix: "app-per", + Prefix: "act-per", AddonConfig: cloudinfo.AddonConfig{ OfferingName: "deploy-arch-ibm-activity-tracker", OfferingFlavor: "fully-configurable",