Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d77c840
feat: added addons
Jul 22, 2025
3fcf658
Merge branch 'main' into addons
vkuma17 Jul 22, 2025
1c7dabf
addons
Jul 23, 2025
ef7f429
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
Jul 23, 2025
bffce77
addons
Jul 23, 2025
8f0f5b1
added scc instance dependency
vkuma17 Aug 20, 2025
ca4668f
addressed review comments
vkuma17 Sep 10, 2025
a66d5f8
updated ocp dependency
vkuma17 Sep 11, 2025
38a622b
updated catalog json
vkuma17 Sep 12, 2025
bb1fa50
added addon test
vkuma17 Sep 13, 2025
baa1881
updated testwrapper version
vkuma17 Sep 13, 2025
b8a6eb0
Merge branch 'main' into addons
vkuma17 Sep 13, 2025
2841d72
added prefix input for addons mapping
vkuma17 Sep 13, 2025
39f5e2b
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
vkuma17 Sep 13, 2025
7d42596
fixed typo
vkuma17 Sep 13, 2025
93e9e3e
disabled event notifications
vkuma17 Sep 13, 2025
379f0ea
public endpoint for OCP addon
vkuma17 Sep 14, 2025
a884425
wait_till IngressReady
vkuma17 Sep 14, 2025
cbb4bc4
access key creation
vkuma17 Sep 17, 2025
afe858d
resolved precommit error
vkuma17 Sep 17, 2025
ad52942
changed validation logic
vkuma17 Sep 17, 2025
73e5729
addressed review comments
vkuma17 Sep 18, 2025
d4fcaf1
Merge branch 'main' into addons
vkuma17 Sep 18, 2025
b918340
Update ibm_catalog.json
vkuma17 Sep 18, 2025
63c3abb
Update main.tf
vkuma17 Sep 19, 2025
78c1995
exposed few more fields in catalog json
vkuma17 Sep 21, 2025
021e002
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
vkuma17 Sep 21, 2025
8b0b835
Update ibm_catalog.json
vkuma17 Sep 22, 2025
75c037c
Update ibm_catalog.json
vkuma17 Sep 22, 2025
1d8f0b5
Update ibm_catalog.json
vkuma17 Sep 22, 2025
68d593b
Update ibm_catalog.json
vkuma17 Sep 22, 2025
666fb01
Merge branch 'main' into addons
vkuma17 Sep 22, 2025
9c413cb
SKIP UPGRADE TEST
vkuma17 Sep 22, 2025
f3d0099
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
vkuma17 Sep 22, 2025
c316f91
fixed test
vkuma17 Sep 22, 2025
c71252f
fixed precommit
vkuma17 Sep 22, 2025
4c10754
Merge branch 'main' into addons
vkuma17 Sep 23, 2025
51c5bad
added instance_crn for upgrade test
vkuma17 Sep 23, 2025
6ac1058
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
vkuma17 Sep 23, 2025
d25728c
Merge branch 'main' into addons
vkuma17 Sep 23, 2025
90db5b0
added prefix variable
vkuma17 Sep 24, 2025
a26e862
Update main.tf
vkuma17 Sep 24, 2025
d7659a6
added provider visibility
vkuma17 Sep 24, 2025
7ac6a7e
Merge branch 'addons' of github.com:terraform-ibm-modules/terraform-i…
vkuma17 Sep 24, 2025
9ebdd20
run on eu-de region
vkuma17 Sep 24, 2025
720128c
random region selector for classic example for monitoring instance
vkuma17 Sep 24, 2025
d9b59f3
skipping addon test
vkuma17 Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
709 changes: 707 additions & 2 deletions ibm_catalog.json

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions solutions/fully-configurable/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,38 @@ data "ibm_container_cluster_config" "cluster_config" {
endpoint_type = var.cluster_config_endpoint_type != "default" ? var.cluster_config_endpoint_type : null
}

locals {
prefix = var.prefix != null ? trimspace(var.prefix) != "" ? "${var.prefix}-" : "" : ""
create_access_key = ((var.access_key != null && var.access_key != "") || (var.existing_access_key_secret_name != null && var.existing_access_key_secret_name != "")) ? 0 : 1
}

module "instance_crn_parser" {
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
version = "1.2.0"
crn = var.instance_crn
}


resource "ibm_resource_key" "key" {
count = local.create_access_key
name = "${local.prefix}key"
resource_instance_id = module.instance_crn_parser.service_instance
role = "Manager"
}

module "monitoring_agent" {
source = "../.."
cluster_id = var.cluster_id
cluster_resource_group_id = var.cluster_resource_group_id
cluster_config_endpoint_type = var.cluster_config_endpoint_type
wait_till = var.wait_till
wait_till_timeout = var.wait_till_timeout
instance_region = var.instance_region
instance_region = module.instance_crn_parser.region
use_private_endpoint = var.use_private_endpoint
is_vpc_cluster = var.is_vpc_cluster
name = var.name
namespace = var.namespace
access_key = var.access_key
access_key = local.create_access_key == 1 ? ibm_resource_key.key[0].credentials["Sysdig Access Key"] : var.access_key
existing_access_key_secret_name = var.existing_access_key_secret_name
agent_tags = var.agent_tags
add_cluster_name = var.add_cluster_name
Expand Down
1 change: 1 addition & 0 deletions solutions/fully-configurable/provider.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
visibility = var.provider_visibility
}

provider "kubernetes" {
Expand Down
58 changes: 47 additions & 11 deletions solutions/fully-configurable/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ variable "ibmcloud_api_key" {
sensitive = true
}

variable "prefix" {
type = string
nullable = true
description = "The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To skip using a prefix, set this value to null or an empty string. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)."

validation {
# - null and empty string is allowed
# - Must not contain consecutive hyphens (--): length(regexall("--", var.prefix)) == 0
# - Starts with a lowercase letter: [a-z]
# - Contains only lowercase letters (a–z), digits (0–9), and hyphens (-)
# - Must not end with a hyphen (-): [a-z0-9]
condition = (var.prefix == null || var.prefix == "" ? true :
alltrue([
can(regex("^[a-z][-a-z0-9]*[a-z0-9]$", var.prefix)),
length(regexall("--", var.prefix)) == 0
])
)
error_message = "Prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It must not end with a hyphen('-'), and cannot contain consecutive hyphens ('--')."
}

validation {
# must not exceed 16 characters in length
condition = var.prefix == null || var.prefix == "" ? true : length(var.prefix) <= 16
error_message = "Prefix must not exceed 16 characters."
}
}

variable "cluster_id" {
type = string
description = "The ID of the cluster you wish to deploy the agent in."
Expand Down Expand Up @@ -66,10 +93,15 @@ variable "wait_till_timeout" {
# Common agent variables
##############################################################################

variable "instance_region" {
variable "instance_crn" {
type = string
description = "The region of the IBM Cloud Monitoring instance that you want to send metrics to. This is used to construct the ingestion and api endpoints. If you are only using the agent for security and compliance monitoring, set this to the region of your IBM Cloud Security and Compliance Center Workload Protection instance. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-docs.md#key-considerations)."
description = "The CRN of the IBM Cloud Monitoring instance that you want to send metrics to. This is used to construct the ingestion and api endpoints. If you are only using the agent for security and compliance monitoring, set this to the crn of your IBM Cloud Security and Compliance Center Workload Protection instance. If you are using this agent for both `monitoring` and `security and compliance` you can provide CRN of any one of them provided they are connected. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-docs.md#key-considerations)."
nullable = false

validation {
condition = var.instance_crn != ""
error_message = "Instance CRN can not be empty."
}
}

variable "use_private_endpoint" {
Expand All @@ -81,21 +113,14 @@ variable "use_private_endpoint" {

variable "access_key" {
type = string
description = "Access key used by the agent to communicate with the instance. Either `access_key` or `existing_access_key_secret_name` is required. This value will be stored in a new secret on the cluster if passed. If you want to use this agent for only metrics or metrics with security and compliance, use a manager key scoped to the IBM Cloud Monitoring instance. If you only want to use the agent for security and compliance use a manager key scoped to the Security and Compliance Center Workload Protection instance."
description = "Access key used by the agent to communicate with the instance. This value will be stored in a new secret on the cluster if passed. If you want to use this agent for only metrics or metrics with security and compliance, use a manager key scoped to the IBM Cloud Monitoring instance. If you only want to use the agent for security and compliance use a manager key scoped to the Security and Compliance Center Workload Protection instance. If neither `access_key` nor `existing_access_key_secret_name` is provided a new Manager Key will be created scoped to the instance provided in `instance_crn`."
sensitive = true
default = null
validation {
condition = (
(var.access_key != null && var.access_key != "") ||
(var.existing_access_key_secret_name != null && var.existing_access_key_secret_name != "")
)
error_message = "Either 'access_key' or 'existing_access_key_secret_name' must be provided and non-empty."
}
}

variable "existing_access_key_secret_name" {
type = string
description = "An alternative to using `access_key`. Specify the name of an existing Kubernetes secret containing the access key in the same namespace that is defined in the `namespace` input. Either `access_key` or `existing_access_key_secret_name` is required."
description = "An alternative to using `access_key`. Specify the name of an existing Kubernetes secret containing the access key in the same namespace that is defined in the `namespace` input. If neither `access_key` nor `existing_access_key_secret_name` is provided a new Manager Key will be created scoped to the instance provided in `instance_crn`."
default = null
}

Expand Down Expand Up @@ -362,3 +387,14 @@ variable "cluster_shield_limits_memory" {
description = "Specify memory resource limits for the cluster shield pods."
default = "1536Mi"
}

variable "provider_visibility" {
description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)."
type = string
default = "private"

validation {
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
}
}
3 changes: 3 additions & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be // indirect
github.com/IBM-Cloud/power-go-client v1.12.0 // indirect
github.com/IBM/cloud-databases-go-sdk v0.8.0 // indirect
github.com/IBM/go-sdk-core v1.1.0 // indirect
github.com/IBM/go-sdk-core/v5 v5.21.0 // indirect
github.com/IBM/platform-services-go-sdk v0.86.1 // indirect
github.com/IBM/project-go-sdk v0.3.6 // indirect
Expand All @@ -29,6 +30,7 @@ require (
github.com/cloudflare/circl v1.6.1 // indirect
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand Down Expand Up @@ -98,6 +100,7 @@ require (
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.35.0 // indirect
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
9 changes: 9 additions & 0 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/IBM-Cloud/power-go-client v1.12.0 h1:tF9Mq5GLYHebpzQT6IYB89lIxEST1E9t
github.com/IBM-Cloud/power-go-client v1.12.0/go.mod h1:SpTK1ttW8bfMNUVQS8qOEuWn2KOkzaCLyzfze8MG1JE=
github.com/IBM/cloud-databases-go-sdk v0.8.0 h1:uMFqhnc/roVTzfCaUsJ23eaHKjChhGpM1F7Mpxik0bo=
github.com/IBM/cloud-databases-go-sdk v0.8.0/go.mod h1:JYucI1PdwqbAd8XGdDAchxzxRP7bxOh1zUnseovHKsc=
github.com/IBM/go-sdk-core v1.1.0 h1:pV73lZqr9r1xKb3h08c1uNG3AphwoV5KzUzhS+pfEqY=
github.com/IBM/go-sdk-core v1.1.0/go.mod h1:2pcx9YWsIsZ3I7kH+1amiAkXvLTZtAq9kbxsfXilSoY=
github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE=
github.com/IBM/go-sdk-core/v5 v5.21.0 h1:DUnYhvC4SoC8T84rx5omnhY3+xcQg/Whyoa3mDPIMkk=
github.com/IBM/go-sdk-core/v5 v5.21.0/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw=
Expand Down Expand Up @@ -48,6 +50,8 @@ github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGL
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
Expand Down Expand Up @@ -106,9 +110,11 @@ github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3Bum
github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
Expand Down Expand Up @@ -193,6 +199,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
Expand Down Expand Up @@ -512,6 +519,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M=
gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
Expand Down
62 changes: 57 additions & 5 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import (
"strings"
"testing"

"github.com/IBM/go-sdk-core/core"
"github.com/gruntwork-io/terratest/modules/files"
"github.com/gruntwork-io/terratest/modules/logger"
"github.com/gruntwork-io/terratest/modules/random"
"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/testaddons"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
)
Expand Down Expand Up @@ -94,7 +96,7 @@ func TestFullyConfigurableSolution(t *testing.T) {

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Prefix: "monitoring-agent",
Prefix: "mon-agent",
TarIncludePatterns: []string{
"*.tf",
"kubeconfig/*.*",
Expand All @@ -114,9 +116,10 @@ func TestFullyConfigurableSolution(t *testing.T) {
})
options.TerraformVars = []testschematic.TestSchematicTerraformVar{
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "instance_region", Value: region, DataType: "string"},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "cluster_id", Value: terraform.Output(t, existingTerraformOptions, "cluster_id"), DataType: "string"},
{Name: "cluster_resource_group_id", Value: terraform.Output(t, existingTerraformOptions, "cluster_resource_group_id"), DataType: "string"},
{Name: "instance_crn", Value: terraform.Output(t, existingTerraformOptions, "instance_crn"), DataType: "string", Secure: true},
{Name: "access_key", Value: terraform.Output(t, existingTerraformOptions, "access_key"), DataType: "string", Secure: true},
{Name: "priority_class_name", Value: "sysdig-daemonset-priority", DataType: "string"},
}
Expand Down Expand Up @@ -178,7 +181,7 @@ func TestFullyConfigurableUpgradeSolution(t *testing.T) {

options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
Prefix: "monitoring-agent",
Prefix: "mon-agent",
TarIncludePatterns: []string{
"*.tf",
"kubeconfig/*.*",
Expand All @@ -199,9 +202,10 @@ func TestFullyConfigurableUpgradeSolution(t *testing.T) {

options.TerraformVars = []testschematic.TestSchematicTerraformVar{
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "instance_region", Value: region, DataType: "string"},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "cluster_id", Value: terraform.Output(t, existingTerraformOptions, "cluster_id"), DataType: "string"},
{Name: "cluster_resource_group_id", Value: terraform.Output(t, existingTerraformOptions, "cluster_resource_group_id"), DataType: "string"},
{Name: "instance_crn", Value: terraform.Output(t, existingTerraformOptions, "instance_crn"), DataType: "string", Secure: true},
{Name: "access_key", Value: terraform.Output(t, existingTerraformOptions, "access_key"), DataType: "string", Secure: true},
}

Expand Down Expand Up @@ -251,7 +255,7 @@ func TestRunAgentClassicKubernetes(t *testing.T) {
Testing: t,
TerraformDir: terraformDirMonitoringAgentIKS,
Prefix: "obs-agent-iks",
Region: "au-syd",
Region: validRegions[rand.IntN(len(validRegions))],
ResourceGroup: resourceGroup,
IgnoreUpdates: testhelper.Exemptions{ // Ignore for consistency check
List: IgnoreUpdates,
Expand All @@ -271,3 +275,51 @@ func TestRunAgentClassicKubernetes(t *testing.T) {
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}

func TestAgentDefaultConfiguration(t *testing.T) {

/*
Skipping this test because auto-approve is not working as expected in projects
Config gets stuck in approved state and doesn't move to deployment
https://github.ibm.com/epx/projects/issues/4814
*/
t.Skip("Skipping because of projects issue")
t.Parallel()

options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
Testing: t,
Prefix: "ma-def",
QuietMode: false,
})

options.AddonConfig = cloudinfo.NewAddonConfigTerraform(
options.Prefix,
"deploy-arch-ibm-monitoring-agent",
"fully-configurable",
map[string]interface{}{
"prefix": options.Prefix,
"secrets_manager_service_plan": "trial",
"region": "eu-de",
},
)

/*
Event notifications is manually disabled in this test because event notifications DA creates kms keys and during undeploy the order of key protect and event notifications
is not considered by projects as EN is not a direct dependency of VSI DA. So undeploy fails, because
key protect instance can't be deleted because of active keys created by EN. Hence for now, we don't want to deploy
EN.

Issue has been created for projects team. https://github.ibm.com/epx/projects/issues/4750
Once that is fixed, we can remove the logic to disable EN
*/
options.AddonConfig.Dependencies = []cloudinfo.AddonConfig{
{
OfferingName: "deploy-arch-ibm-event-notifications",
OfferingFlavor: "fully-configurable",
Enabled: core.BoolPtr(false), // explicitly disabled
},
}

err := options.RunAddonTest()
require.NoError(t, err)
}
6 changes: 6 additions & 0 deletions tests/resources/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ output "access_key" {
description = "The access key of the provisioned IBM Cloud Monitoring instance."
sensitive = true
}

output "instance_crn" {
value = module.cloud_monitoring.crn
description = "The access key of the provisioned IBM Cloud Monitoring instance."
sensitive = true
}