Skip to content

Commit 7b7f417

Browse files
authored
Merge branch 'main' into test-coverage
2 parents 8fe95d5 + 4c479d8 commit 7b7f417

File tree

8 files changed

+82
-50
lines changed

8 files changed

+82
-50
lines changed

.secrets.baseline

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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"

ibm_catalog.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,26 @@
351351
},
352352
{
353353
"key": "kibana_image_digest"
354+
},
355+
{
356+
"key": "kibana_image_port"
357+
},
358+
{
359+
"key": "kibana_visibility",
360+
"options": [
361+
{
362+
"displayname": "local_public",
363+
"value": "local_public"
364+
},
365+
{
366+
"displayname": "local_private",
367+
"value": "local_private"
368+
},
369+
{
370+
"displayname": "local",
371+
"value": "local"
372+
}
373+
]
354374
}
355375
]
356376
}

solutions/standard/DA-types.md

Lines changed: 11 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,22 +183,22 @@ 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
}
203199
]
204200
```
201+
### Options for kibana_visibility
202+
203+
When the Kibana application visibility is changed from private to public using `kibana_visibility` variable, it will become accessible from the public Internet. However, access via the IBM Cloud private network will no longer be available. This change takes effect immediately, potentially impacting active users or integrations. It is important to consider the associated security implications before proceeding, [learn more](https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloads#optionsvisibility).
204+
If Kibana is enabled, you can access the Kibana application over a IBM private network using the method outlined [here](https://cloud.ibm.com/docs/codeengine?topic=codeengine-vpe).

solutions/standard/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ This architecture creates an instance of IBM Cloud Databases for Elasticsearch a
66
- A KMS root key, if one is not passed in.
77
- An IBM Cloud Databases for Elasticsearch instance with KMS encryption.
88
- Autoscaling rules for the database instance, if provided.
9-
- Kibana dashboard for Elasticsearch.
9+
- Install and start the Elastic's Natural Language Processing model, if enabled.
10+
- Kibana dashboard for Elasticsearch, if enabled.
11+
12+
**Note on accessing Kibana:** If Kibana is enabled, you can access the Kibana application over a IBM private network using the method outlined [here](https://cloud.ibm.com/docs/codeengine?topic=codeengine-vpe).
13+
14+
**Note on setting kibana_visibility:** When the Kibana application visibility is changed from private to public using kibana_visibility variable, it will become accessible from the public Internet. However, access via the IBM Cloud private network will no longer be available. This change takes effect immediately, potentially impacting active users or integrations. It is important to consider the associated security implications before proceeding.
1015

1116
![fscloud-elastic-search](../../reference-architecture/deployable-architecture-elasticsearch.svg)
1217

solutions/standard/main.tf

Lines changed: 15 additions & 14 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
@@ -463,7 +463,7 @@ module "code_engine_kibana" {
463463
apps = {
464464
(local.code_engine_app_name) = {
465465
image_reference = var.kibana_image_digest != null ? "${var.kibana_registry_namespace_image}@${var.kibana_image_digest}" : "${var.kibana_registry_namespace_image}:${local.kibana_version}"
466-
image_port = 5601
466+
image_port = var.kibana_image_port
467467
run_env_variables = [{
468468
type = "literal"
469469
name = "ELASTICSEARCH_HOSTS"
@@ -496,8 +496,9 @@ module "code_engine_kibana" {
496496
value = "none"
497497
}
498498
]
499-
scale_min_instances = 1
500-
scale_max_instances = 3
499+
scale_min_instances = 1
500+
scale_max_instances = 3
501+
managed_domain_mappings = var.kibana_visibility
501502
}
502503
}
503504
}

solutions/standard/variables.tf

Lines changed: 27 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

@@ -380,3 +379,18 @@ variable "kibana_image_digest" {
380379

381380

382381
}
382+
variable "kibana_image_port" {
383+
description = "Specify the port number used to connect to the Kibana service exposed by the container image. Default port is 5601 and it is only applicable if `enable_kibana_dashboard` is true"
384+
type = number
385+
default = 5601
386+
}
387+
388+
variable "kibana_visibility" {
389+
description = "Specify the visibility of Kibana application in order to define which endpoint is available for receiving the requests. Valid values are 'local_public', 'local_private' and 'local' and it is only applicable if `enable_kibana_dashboard` is true. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-icd-elasticsearch/blob/main/solutions/standard/DA-types.md#options-for-kibana_visibility)."
390+
type = string
391+
default = "local_private"
392+
validation {
393+
condition = can(regex("local_public|local_private|local", var.kibana_visibility))
394+
error_message = "Valid values are 'local_public', 'local_private', or 'local'."
395+
}
396+
}

tests/pr_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
8181
"service_credentials": []map[string]string{
8282
{
8383
"secret_name": fmt.Sprintf("%s-cred-reader", options.Prefix),
84-
"service_credentials_source_service_role": "Reader",
84+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Viewer",
8585
},
8686
{
8787
"secret_name": fmt.Sprintf("%s-cred-writer", options.Prefix),
88-
"service_credentials_source_service_role": "Writer",
88+
"service_credentials_source_service_role_crn": "crn:v1:bluemix:public:iam::::role:Editor",
8989
},
9090
},
9191
},

0 commit comments

Comments
 (0)