Skip to content

Commit 29f4ed8

Browse files
committed
fix tests and expose the ability to create secrets groups
1 parent aa10bdf commit 29f4ed8

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

ibm_catalog.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@
233233
"type": "string",
234234
"default_value": "Default",
235235
"description": "The name of an existing resource group to provision the resources.",
236-
"required": true,
237236
"custom_config": {
238237
"type": "resource_group",
239238
"grouping": "deployment",
@@ -365,6 +364,17 @@
365364
"description": "Whether to skip the creation of the IAM authorization policies required to enable the Secrets Manager IAM credentials engine. If set to false, policies will be created that grants the Secrets Manager instance 'Operator' access to the IAM identity service, and 'Groups Service Member Manage' access to the IAM groups service.",
366365
"required": false
367366
},
367+
{
368+
"key": "secrets_manager_secret_groups",
369+
"type": "array",
370+
"default_value": "[\n {\n secret_group_name = \"General\"\n secret_group_description = \"A general purpose secrets group with an associated access group which has a secrets reader role\"\n create_access_group = true\n access_group_name = \"general-secrets-group-access-group\"\n access_group_roles = [\"SecretsReader\"]\n }\n ]",
371+
"description": "Secret Manager secret group and access group configurations. If a prefix input variable is specified, it is added to the `access_group_name` value in the `<prefix>-value` format. If you do not wish to create any groups, set the value to `[]`. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-secrets-manager/tree/main/solutions/fully-configurable/provisioning_secrets_groups.md).",
372+
"custom_config": {
373+
"type": "code_editor",
374+
"grouping": "deployment",
375+
"original_grouping": "deployment"
376+
}
377+
},
368378
{
369379
"key": "app_config_plan",
370380
"type": "string",

stack_definition.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
"hidden": false,
7070
"custom_config": {}
7171
},
72+
{
73+
"name": "secrets_manager_secret_groups",
74+
"required": false,
75+
"type": "array",
76+
"hidden": false,
77+
"custom_config": {}
78+
},
7279
{
7380
"name": "app_config_plan",
7481
"required": false,
@@ -449,6 +456,10 @@
449456
{
450457
"name": "skip_secrets_manager_iam_auth_policy",
451458
"value": "ref:../../inputs/skip_secrets_manager_iam_auth_policy"
459+
},
460+
{
461+
"name": "secret_groups",
462+
"value": "ref:../../inputs/secrets_manager_secret_groups"
452463
}
453464
],
454465
"name": "3d - Secrets Manager",

tests/pr_test.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ func TestProjectsFullTest(t *testing.T) {
5252
})
5353

5454
options.StackInputs = map[string]interface{}{
55-
"prefix": options.Prefix,
56-
"region": validRegions[rand.Intn(len(validRegions))],
57-
"existing_resource_group_name": resourceGroup,
58-
"sm_service_plan": "trial",
59-
"ibmcloud_api_key": options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], // always required by the stack
60-
"enable_platform_metrics": false,
61-
"en_email_list": []string{"[email protected]"},
55+
"prefix": options.Prefix,
56+
"region": validRegions[rand.Intn(len(validRegions))],
57+
"existing_resource_group_name": resourceGroup,
58+
"secrets_manager_service_plan": "trial",
59+
"ibmcloud_api_key": options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], // always required by the stack
60+
"enable_platform_metrics": false,
61+
"event_notifications_email_list": []string{"[email protected]"},
6262
}
6363

6464
err := options.RunProjectsTest()
@@ -114,15 +114,16 @@ func TestProjectsExistingResourcesTest(t *testing.T) {
114114
})
115115

116116
options.StackInputs = map[string]interface{}{
117-
"prefix": terraform.Output(t, existingTerraformOptions, "prefix"),
118-
"region": terraform.Output(t, existingTerraformOptions, "region"),
119-
"existing_resource_group_name": terraform.Output(t, existingTerraformOptions, "resource_group_name"),
120-
"ibmcloud_api_key": options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], // always required by the stack
121-
"enable_platform_metrics": false,
122-
"existing_secrets_manager_crn": terraform.Output(t, existingTerraformOptions, "secrets_manager_instance_crn"),
123-
"skip_iam_authorization_policy": true, // skip as s2s auth policy was already created for existing instance
124-
"existing_kms_instance_crn": terraform.Output(t, existingTerraformOptions, "key_project_instance_crn"),
125-
"en_email_list": []string{"[email protected]"},
117+
"prefix": terraform.Output(t, existingTerraformOptions, "prefix"),
118+
"region": terraform.Output(t, existingTerraformOptions, "region"),
119+
"existing_resource_group_name": terraform.Output(t, existingTerraformOptions, "resource_group_name"),
120+
"ibmcloud_api_key": options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], // always required by the stack
121+
"enable_platform_metrics": false,
122+
"existing_secrets_manager_crn": terraform.Output(t, existingTerraformOptions, "secrets_manager_instance_crn"),
123+
"skip_secrets_manager_iam_auth_policy": true, // skip as s2s auth policy was already created for existing instance
124+
"existing_kms_instance_crn": terraform.Output(t, existingTerraformOptions, "key_project_instance_crn"),
125+
"event_notifications_email_list": []string{"[email protected]"},
126+
"secrets_manager_secret_groups": []string{}, // Don't create any secret groups in existing instance (The default 'General' group already exists)
126127
}
127128

128129
err := options.RunProjectsTest()

0 commit comments

Comments
 (0)