Skip to content

Commit db16182

Browse files
authored
feat: remove Account Config DA from customize DA flow, add default value for prefix using random string generator and update logic that handles default resource group lookup (#322)
* feat: remove Account Config DA from customize DA flow, add default value for prefix using random string generator and update logic that handles default resource group lookup * remove dependency_version_2
1 parent 6cb4837 commit db16182

File tree

4 files changed

+15
-83
lines changed

4 files changed

+15
-83
lines changed

ibm_catalog.json

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,6 @@
6262
]
6363
},
6464
"iam_permissions": [
65-
{
66-
"role_crns": [
67-
"crn:v1:bluemix:public:iam::::role:Administrator"
68-
],
69-
"service_name": "All Account Management services",
70-
"notes": "[Optional] Required to create new resource groups when enabling the Account Configuration integration."
71-
},
72-
{
73-
"role_crns": [
74-
"crn:v1:bluemix:public:iam::::role:Administrator"
75-
],
76-
"service_name": "All Identity and Access enabled services",
77-
"notes": "[Optional] Required to create new resource groups with account settings when enabling the Account Configuration integration."
78-
},
7965
{
8066
"role_crns": [
8167
"crn:v1:bluemix:public:iam::::serviceRole:Manager"
@@ -109,42 +95,25 @@
10995
}
11096
]
11197
},
112-
"dependencies": [
113-
{
114-
"name": "deploy-arch-ibm-account-infra-base",
115-
"description": "Organize your IBM Cloud account with preconfigured resource groups. If not selected, the default resource group is used. Optionally, expand to apply recommended security controls via \"with Account Settings\" variation.",
116-
"catalog_id": "7a4d68b4-cf8b-40cd-a3d1-f49aff526eb3",
117-
"flavors": [
118-
"resource-group-only",
119-
"resource-groups-with-account-settings"
120-
],
121-
"default_flavor": "resource-group-only",
122-
"id": "63641cec-6093-4b4f-b7b0-98d2f4185cd6-global",
123-
"input_mapping": [
124-
{
125-
"dependency_output": "workload_resource_group_name",
126-
"version_input": "existing_resource_group_name"
127-
},
128-
{
129-
"dependency_input": "prefix",
130-
"version_input": "prefix",
131-
"reference_version": true
132-
}
133-
],
134-
"optional": true,
135-
"on_by_default": false,
136-
"version": "v3.0.23"
137-
}
138-
],
139-
"dependency_version_2": true,
14098
"terraform_version": "1.10.5",
14199
"configuration": [
142100
{
143101
"key": "ibmcloud_api_key"
144102
},
145103
{
146104
"key": "prefix",
147-
"required": true
105+
"required": true,
106+
"default_value": "dev",
107+
"random_string": {
108+
"length": 4
109+
},
110+
"value_constraints": [
111+
{
112+
"type": "regex",
113+
"description": "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 ('--'). It should not exceed 16 characters.",
114+
"value": "^$|^__NULL__$|^[a-z](?!.*--)(?:[a-z0-9-]{0,14}[a-z0-9])?$"
115+
}
116+
]
148117
},
149118
{
150119
"key": "existing_resource_group_name",

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module "resource_group" {
66
source = "terraform-ibm-modules/resource-group/ibm"
7-
version = "1.3.0"
7+
version = "1.4.0"
88
existing_resource_group_name = var.existing_resource_group_name
99
}
1010

solutions/fully-configurable/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ variable "ibmcloud_api_key" {
1010

1111
variable "existing_resource_group_name" {
1212
type = string
13-
description = "The name of an existing resource group to provision the resources. If not provided the default resource group will be used."
14-
default = null
13+
description = "The name of an existing resource group to provision the resources."
14+
default = "Default"
1515
}
1616

1717
variable "prefix" {

tests/pr_test.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ import (
1010
"strings"
1111
"testing"
1212

13-
"github.com/IBM/go-sdk-core/v5/core"
1413
"github.com/gruntwork-io/terratest/modules/files"
1514
"github.com/gruntwork-io/terratest/modules/logger"
1615
"github.com/gruntwork-io/terratest/modules/random"
1716
"github.com/gruntwork-io/terratest/modules/terraform"
1817
"github.com/stretchr/testify/assert"
1918
"github.com/stretchr/testify/require"
20-
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo"
21-
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons"
2219
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
2320
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
2421
)
@@ -223,37 +220,3 @@ func TestRunExistingResourcesExample(t *testing.T) {
223220
logger.Log(t, "END: Destroy (existing resources)")
224221
}
225222
}
226-
227-
// This DA has no "on-by-default" dependencies defined so hence testing with Account Config DA enabled
228-
func TestAddonWithAccountConfig(t *testing.T) {
229-
t.Parallel()
230-
231-
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
232-
Testing: t,
233-
Prefix: "icr-addon",
234-
ResourceGroup: resourceGroup,
235-
QuietMode: true, // Suppress logs except on failure
236-
})
237-
238-
options.AddonConfig = cloudinfo.NewAddonConfigTerraform(
239-
options.Prefix,
240-
"deploy-arch-ibm-container-registry",
241-
"fully-configurable",
242-
map[string]interface{}{
243-
"prefix": options.Prefix,
244-
"namespace_region": "us-south",
245-
},
246-
)
247-
248-
// Enable Account Config DA
249-
options.AddonConfig.Dependencies = []cloudinfo.AddonConfig{
250-
{
251-
OfferingName: "deploy-arch-ibm-account-infra-base",
252-
OfferingFlavor: "resource-groups-with-account-settings",
253-
Enabled: core.BoolPtr(true), // explicitly enable this dependency
254-
},
255-
}
256-
257-
err := options.RunAddonTest()
258-
require.NoError(t, err)
259-
}

0 commit comments

Comments
 (0)