Skip to content

Commit 05cc772

Browse files
authored
feat: DA updated to support the "add-ons" (dependency) flow in IBM Cloud catalog (#365)
1 parent 5a12e02 commit 05cc772

File tree

5 files changed

+195
-5
lines changed

5 files changed

+195
-5
lines changed

ibm_catalog.json

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,54 @@
251251
{
252252
"key": "cert_other_sans"
253253
},
254+
{
255+
"key": "root_ca_name",
256+
"type": "string",
257+
"required": true,
258+
"virtual": true,
259+
"default_value": "root-ca",
260+
"description": "The name of the Root Certificate Authority."
261+
},
262+
{
263+
"key": "root_ca_common_name",
264+
"type": "string",
265+
"required": true,
266+
"virtual": true,
267+
"default_value": "example-root.com",
268+
"description": "The common name of the Root Certificate Authority."
269+
},
270+
{
271+
"key": "intermediate_ca_name",
272+
"type": "string",
273+
"required": true,
274+
"virtual": true,
275+
"default_value": "intermediate-ca",
276+
"description": "The name of the Intermediate Certificate Authority."
277+
},
278+
{
279+
"key": "intermediate_ca_common_name",
280+
"type": "string",
281+
"required": true,
282+
"virtual": true,
283+
"default_value": "example-int.com",
284+
"description": "The common name of the Intermediate Certificate Authority."
285+
},
286+
{
287+
"key": "certificate_template_name",
288+
"type": "string",
289+
"required": true,
290+
"virtual": true,
291+
"default_value": "template",
292+
"description": "The name of the Certificate Template."
293+
},
294+
{
295+
"key": "template_max_ttl",
296+
"type": "string",
297+
"required": true,
298+
"virtual": true,
299+
"default_value": "8760h",
300+
"description": "Max TTL for the certificate template."
301+
},
254302
{
255303
"key": "provider_visibility",
256304
"hidden": true,
@@ -346,7 +394,7 @@
346394
{
347395
"name": "deploy-arch-ibm-secrets-manager",
348396
"id": "6d6ebc76-7bbd-42f5-8bc7-78f4fabd5944-global",
349-
"version": "v2.8.0",
397+
"version": "v2.10.0",
350398
"flavors": [
351399
"fully-configurable"
352400
],
@@ -377,6 +425,76 @@
377425
"version_input": "existing_secrets_manager_crn"
378426
}
379427
]
428+
},
429+
{
430+
"name": "deploy-arch-secrets-manager-private-cert-engine",
431+
"id": "571d2eb7-e416-40a4-aa95-be05e6155af8-global",
432+
"version": "v1.8.0",
433+
"flavors": [
434+
"fully-configurable"
435+
],
436+
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
437+
"optional": true,
438+
"on_by_default": true,
439+
"ignore_auto_referencing": [
440+
"*"
441+
],
442+
"input_mapping": [
443+
{
444+
"dependency_input": "prefix",
445+
"version_input": "prefix",
446+
"reference_version": true
447+
},
448+
{
449+
"dependency_input": "secrets_manager_region",
450+
"version_input": "secrets_manager_region",
451+
"reference_version": true
452+
},
453+
{
454+
"dependency_input": "existing_secrets_manager_crn",
455+
"version_input": "existing_secrets_manager_crn",
456+
"reference_version": true
457+
},
458+
{
459+
"dependency_input": "secrets_manager_service_plan",
460+
"version_input": "secrets_manager_service_plan",
461+
"reference_version": true
462+
},
463+
{
464+
"dependency_input": "root_ca_name",
465+
"version_input": "root_ca_name",
466+
"reference_version": true
467+
},
468+
{
469+
"dependency_input": "root_ca_common_name",
470+
"version_input": "root_ca_common_name",
471+
"reference_version": true
472+
},
473+
{
474+
"dependency_input": "intermediate_ca_name",
475+
"version_input": "intermediate_ca_name",
476+
"reference_version": true
477+
},
478+
{
479+
"dependency_input": "intermediate_ca_common_name",
480+
"version_input": "intermediate_ca_common_name",
481+
"reference_version": true
482+
},
483+
{
484+
"dependency_input": "certificate_template_name",
485+
"version_input": "certificate_template_name",
486+
"reference_version": true
487+
},
488+
{
489+
"dependency_input": "template_max_ttl",
490+
"version_input": "template_max_ttl",
491+
"reference_version": true
492+
},
493+
{
494+
"dependency_output": "template_name",
495+
"version_input": "cert_template"
496+
}
497+
]
380498
}
381499
],
382500
"dependency_version_2": true,

solutions/fully-configurable/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ variable "cert_secrets_group_id" {
9898

9999
variable "cert_template" {
100100
type = string
101-
description = "Name of the certificate template to use."
101+
description = "Name of the existing certificate template to use for creating certificate."
102102

103103
validation {
104104
condition = length(var.cert_template) >= 2 && length(var.cert_template) <= 128

tests/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ toolchain go1.25.1
66

77
require (
88
github.com/stretchr/testify v1.11.1
9-
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.6
9+
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.8
1010
)
1111

1212
require (
1313
dario.cat/mergo v1.0.0 // indirect
1414
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be // indirect
1515
github.com/IBM-Cloud/power-go-client v1.12.0 // indirect
1616
github.com/IBM/cloud-databases-go-sdk v0.8.0 // indirect
17+
github.com/IBM/go-sdk-core v1.1.0 // indirect
1718
github.com/IBM/go-sdk-core/v5 v5.21.0 // indirect
1819
github.com/IBM/platform-services-go-sdk v0.86.1 // indirect
1920
github.com/IBM/project-go-sdk v0.3.6 // indirect
@@ -28,6 +29,7 @@ require (
2829
github.com/cloudflare/circl v1.6.1 // indirect
2930
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
3031
github.com/davecgh/go-spew v1.1.1 // indirect
32+
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
3133
github.com/emirpasic/gods v1.18.1 // indirect
3234
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
3335
github.com/ghodss/yaml v1.0.0 // indirect
@@ -97,6 +99,7 @@ require (
9799
golang.org/x/sys v0.35.0 // indirect
98100
golang.org/x/text v0.28.0 // indirect
99101
golang.org/x/tools v0.35.0 // indirect
102+
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
100103
gopkg.in/warnings.v0 v0.1.2 // indirect
101104
gopkg.in/yaml.v2 v2.4.0 // indirect
102105
gopkg.in/yaml.v3 v3.0.1 // indirect

tests/go.sum

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/IBM-Cloud/power-go-client v1.12.0 h1:tF9Mq5GLYHebpzQT6IYB89lIxEST1E9t
66
github.com/IBM-Cloud/power-go-client v1.12.0/go.mod h1:SpTK1ttW8bfMNUVQS8qOEuWn2KOkzaCLyzfze8MG1JE=
77
github.com/IBM/cloud-databases-go-sdk v0.8.0 h1:uMFqhnc/roVTzfCaUsJ23eaHKjChhGpM1F7Mpxik0bo=
88
github.com/IBM/cloud-databases-go-sdk v0.8.0/go.mod h1:JYucI1PdwqbAd8XGdDAchxzxRP7bxOh1zUnseovHKsc=
9+
github.com/IBM/go-sdk-core v1.1.0 h1:pV73lZqr9r1xKb3h08c1uNG3AphwoV5KzUzhS+pfEqY=
10+
github.com/IBM/go-sdk-core v1.1.0/go.mod h1:2pcx9YWsIsZ3I7kH+1amiAkXvLTZtAq9kbxsfXilSoY=
911
github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE=
1012
github.com/IBM/go-sdk-core/v5 v5.21.0 h1:DUnYhvC4SoC8T84rx5omnhY3+xcQg/Whyoa3mDPIMkk=
1113
github.com/IBM/go-sdk-core/v5 v5.21.0/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw=
@@ -48,6 +50,8 @@ github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGL
4850
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4951
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5052
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
53+
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
54+
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
5155
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
5256
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
5357
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
@@ -106,9 +110,11 @@ github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3Bum
106110
github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ=
107111
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
108112
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
113+
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
109114
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
110115
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
111116
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
117+
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
112118
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
113119
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
114120
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
@@ -193,6 +199,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
193199
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
194200
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
195201
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
202+
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
196203
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
197204
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
198205
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
@@ -295,8 +302,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
295302
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
296303
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
297304
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
298-
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.6 h1:Tr7AlrQ+s1Nc9VOwB+It8sItnDOXhfXTxKqI2KtdyFA=
299-
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.6/go.mod h1:YBrRYc+5y5Pr9CXmY35lOqTQdlIjA4x4+3iVObXGOCE=
305+
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.8 h1:jBVVDyroAonQs+PMWQ0xQOkBcvbPEgExOrskUFO4AQk=
306+
github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.60.8/go.mod h1:YBrRYc+5y5Pr9CXmY35lOqTQdlIjA4x4+3iVObXGOCE=
300307
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
301308
github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw=
302309
github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk=
@@ -510,6 +517,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
510517
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
511518
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
512519
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
520+
gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
521+
gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M=
513522
gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
514523
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
515524
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=

tests/pr_test.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ import (
77
"os"
88
"testing"
99

10+
"github.com/IBM/go-sdk-core/core"
1011
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
13+
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo"
1114
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common"
15+
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons"
1216
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
1317
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
1418
)
@@ -126,3 +130,59 @@ func TestRunSolutionsFullyConfigurableUpgradeSchematics(t *testing.T) {
126130
assert.Nil(t, err, "This should not have errored")
127131
}
128132
}
133+
134+
func TestAddonsDefaultConfiguration(t *testing.T) {
135+
136+
t.Parallel()
137+
138+
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
139+
Testing: t,
140+
Prefix: "sm-priv-cert",
141+
ResourceGroup: resourceGroup,
142+
OverrideInputMappings: core.BoolPtr(true),
143+
QuietMode: false, // Suppress logs except on failure
144+
})
145+
146+
options.AddonConfig = cloudinfo.NewAddonConfigTerraform(
147+
options.Prefix,
148+
"deploy-arch-secrets-manager-private-cert",
149+
"fully-configurable",
150+
map[string]interface{}{
151+
"prefix": options.Prefix,
152+
"secrets_manager_region": "eu-de",
153+
"secrets_manager_service_plan": "trial",
154+
},
155+
)
156+
157+
// use existing secrets manager instance to prevent hitting 20 trial instance limit in account
158+
options.AddonConfig.Dependencies = []cloudinfo.AddonConfig{
159+
{
160+
OfferingName: "deploy-arch-ibm-secrets-manager",
161+
OfferingFlavor: "fully-configurable",
162+
Inputs: map[string]interface{}{
163+
"existing_secrets_manager_crn": permanentResources["privateOnlySecMgrCRN"],
164+
"service_plan": "__NULL__", // no plan value needed when using existing SM
165+
"skip_secrets_manager_iam_auth_policy": true, // since using an existing Secrets Manager instance, attempting to re-create auth policy can cause conflicts if the policy already exists
166+
"secret_groups": []string{}, // passing empty array for secret groups as default value is creating general group and it will cause conflicts as we are using an existing SM
167+
},
168+
},
169+
// // Disable target / route creation to prevent hitting quota in account
170+
{
171+
OfferingName: "deploy-arch-ibm-cloud-monitoring",
172+
OfferingFlavor: "fully-configurable",
173+
Inputs: map[string]interface{}{
174+
"enable_metrics_routing_to_cloud_monitoring": false,
175+
},
176+
},
177+
{
178+
OfferingName: "deploy-arch-ibm-activity-tracker",
179+
OfferingFlavor: "fully-configurable",
180+
Inputs: map[string]interface{}{
181+
"enable_activity_tracker_event_routing_to_cloud_logs": false,
182+
},
183+
},
184+
}
185+
186+
err := options.RunAddonTest()
187+
require.NoError(t, err)
188+
}

0 commit comments

Comments
 (0)