Skip to content

Commit 728aa89

Browse files
authored
Merge branch 'main' into kibana_enpoint
2 parents ec81eb4 + e06dfff commit 728aa89

File tree

6 files changed

+34
-47
lines changed

6 files changed

+34
-47
lines changed

.secrets.baseline

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-12-09T17:04:45Z",
6+
"generated_at": "2025-01-27T10:25:29Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -103,14 +103,6 @@
103103
"line_number": 64,
104104
"type": "Secret Keyword",
105105
"verified_result": null
106-
},
107-
{
108-
"hashed_secret": "1e5c2f367f02e47a8c160cda1cd9d91decbac441",
109-
"is_secret": false,
110-
"is_verified": false,
111-
"line_number": 192,
112-
"type": "Secret Keyword",
113-
"verified_result": null
114106
}
115107
]
116108
},

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module "icd_elasticsearch" {
9595
module "secrets_manager" {
9696
count = var.existing_sm_instance_guid == null ? 1 : 0
9797
source = "terraform-ibm-modules/secrets-manager/ibm"
98-
version = "1.20.0"
98+
version = "1.22.0"
9999
resource_group_id = module.resource_group.resource_group_id
100100
region = var.region
101101
secrets_manager_name = "${var.prefix}-secrets-manager"

solutions/standard/DA-types.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ To enter a custom value, use the edit action to open the "Edit Array" panel. Add
156156
### Options for service_credentials
157157

158158
- `secret_name`: (required): A unique human-readable name of the secret to create.
159-
- `service_credentials_source_service_role`: (required): The role to give the service credential in the Databases for Elasticsearch service. Acceptable values are `Writer`, `Reader`, `Manager`, and `None`
159+
- `service_credentials_source_service_role_crn`: (required): The CRN of the role to give the service credential in the IBM Cloud Database service. Service credentials role CRNs can be found at https://cloud.ibm.com/iam/roles, select the IBM Cloud Database and select the role.
160160
- `secret_labels`: (optional, default = `[]`): Labels of the secret to create. Up to 30 labels can be created. Labels can be 2 - 30 characters, including spaces. Special characters that are not permitted include the angled brackets (<>), comma (,), colon (:), ampersand (&), and vertical pipe character (|).
161161
- `secret_auto_rotation`: (optional, default = `true`): Whether to configure automatic rotation of service credential.
162162
- `secret_auto_rotation_unit`: (optional, default = `day`): Specifies the unit of time for rotation of a secret. Acceptable values are `day` or `month`.
@@ -170,11 +170,11 @@ The following example includes all the configuration options for four service cr
170170
{
171171
"secret_group_name": "sg-1"
172172
"existing_secret_group": true
173-
"service_credentials": [
173+
"service_credentials": [ # pragma: allowlist secret
174174
{
175175
"secret_name": "cred-1"
176-
"service_credentials_source_service_role": "Writer"
177-
"secret_labels": ["test-writer-1", "test-writer-2"]
176+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Editor"
177+
"secret_labels": ["test-editor-1", "test-editor-2"]
178178
"secret_auto_rotation": true
179179
"secret_auto_rotation_unit": "day"
180180
"secret_auto_rotation_interval": 89
@@ -183,20 +183,16 @@ The following example includes all the configuration options for four service cr
183183
},
184184
{
185185
"secret_name": "cred-2"
186-
"service_credentials_source_service_role": "Reader"
186+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Viewer"
187187
}
188188
]
189189
},
190190
{
191191
"secret_group_name": "sg-2"
192-
"service_credentials": [
192+
"service_credentials": [ # pragma: allowlist secret
193193
{
194194
"secret_name": "cred-3"
195-
"service_credentials_source_service_role": "Editor"
196-
},
197-
{
198-
"secret_name": "cred-4"
199-
"service_credentials_source_service_role": "None"
195+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Viewer"
200196
}
201197
]
202198
}

solutions/standard/main.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,16 @@ locals {
381381
existing_secret_group = service_credentials.existing_secret_group
382382
secrets = [
383383
for secret in service_credentials.service_credentials : {
384-
secret_name = secret.secret_name
385-
secret_labels = secret.secret_labels
386-
secret_auto_rotation = secret.secret_auto_rotation
387-
secret_auto_rotation_unit = secret.secret_auto_rotation_unit
388-
secret_auto_rotation_interval = secret.secret_auto_rotation_interval
389-
service_credentials_ttl = secret.service_credentials_ttl
390-
service_credential_secret_description = secret.service_credential_secret_description
391-
service_credentials_source_service_role = secret.service_credentials_source_service_role
392-
service_credentials_source_service_crn = local.elasticsearch_crn
393-
secret_type = "service_credentials" #checkov:skip=CKV_SECRET_6
384+
secret_name = secret.secret_name
385+
secret_labels = secret.secret_labels
386+
secret_auto_rotation = secret.secret_auto_rotation
387+
secret_auto_rotation_unit = secret.secret_auto_rotation_unit
388+
secret_auto_rotation_interval = secret.secret_auto_rotation_interval
389+
service_credentials_ttl = secret.service_credentials_ttl
390+
service_credential_secret_description = secret.service_credential_secret_description
391+
service_credentials_source_service_role_crn = secret.service_credentials_source_service_role_crn
392+
service_credentials_source_service_crn = local.elasticsearch_crn
393+
secret_type = "service_credentials" #checkov:skip=CKV_SECRET_6
394394
}
395395
]
396396
}
@@ -420,7 +420,7 @@ module "secrets_manager_service_credentials" {
420420
count = var.existing_secrets_manager_instance_crn == null ? 0 : 1
421421
depends_on = [time_sleep.wait_for_es_authorization_policy]
422422
source = "terraform-ibm-modules/secrets-manager/ibm//modules/secrets"
423-
version = "1.20.0"
423+
version = "1.22.0"
424424
existing_sm_instance_guid = local.existing_secrets_manager_instance_guid
425425
existing_sm_instance_region = local.existing_secrets_manager_instance_region
426426
endpoint_type = var.existing_secrets_manager_endpoint_type

solutions/standard/variables.tf

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -296,30 +296,29 @@ variable "service_credential_secrets" {
296296
secret_group_description = optional(string)
297297
existing_secret_group = optional(bool)
298298
service_credentials = list(object({
299-
secret_name = string
300-
service_credentials_source_service_role = string
301-
secret_labels = optional(list(string))
302-
secret_auto_rotation = optional(bool)
303-
secret_auto_rotation_unit = optional(string)
304-
secret_auto_rotation_interval = optional(number)
305-
service_credentials_ttl = optional(string)
306-
service_credential_secret_description = optional(string)
299+
secret_name = string
300+
service_credentials_source_service_role_crn = string
301+
secret_labels = optional(list(string))
302+
secret_auto_rotation = optional(bool)
303+
secret_auto_rotation_unit = optional(string)
304+
secret_auto_rotation_interval = optional(number)
305+
service_credentials_ttl = optional(string)
306+
service_credential_secret_description = optional(string)
307307

308308
}))
309309
}))
310310
default = []
311311
description = "Service credential secrets configuration for Databases for Elasticsearch. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-icd-elasticsearch/blob/main/solutions/standard/DA-types.md#service-credential-secrets)."
312312

313313
validation {
314+
# Service roles CRNs can be found at https://cloud.ibm.com/iam/roles, select the IBM Cloud Database and select the role
314315
condition = alltrue([
315316
for group in var.service_credential_secrets : alltrue([
316-
for credential in group.service_credentials : contains(
317-
["Writer", "Reader", "Manager", "None"], credential.service_credentials_source_service_role
318-
)
317+
# crn:v?:bluemix; two non-empty segments; three possibly empty segments; :serviceRole or role: non-empty segment
318+
for credential in group.service_credentials : can(regex("^crn:v[0-9]:bluemix(:..*){2}(:.*){3}:(serviceRole|role):..*$", credential.service_credentials_source_service_role_crn))
319319
])
320320
])
321-
error_message = "service_credentials_source_service_role role must be one of 'Writer', 'Reader', 'Manager', and 'None'."
322-
321+
error_message = "service_credentials_source_service_role_crn must be a serviceRole CRN. See https://cloud.ibm.com/iam/roles"
323322
}
324323
}
325324

tests/pr_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
106106
"service_credentials": []map[string]string{
107107
{
108108
"secret_name": fmt.Sprintf("%s-cred-reader", options.Prefix),
109-
"service_credentials_source_service_role": "Reader",
109+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Viewer",
110110
},
111111
{
112112
"secret_name": fmt.Sprintf("%s-cred-writer", options.Prefix),
113-
"service_credentials_source_service_role": "Writer",
113+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Editor",
114114
},
115115
},
116116
},

0 commit comments

Comments
 (0)