Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@
{
"key": "kibana_image_port"
},
{
"key": "kibana_system_secret_name"
},
{
"key": "kibana_app_secret_name"
},
{
"key": "cbr_code_engine_kibana_project_rules"
},
Expand Down Expand Up @@ -841,6 +847,12 @@
{
"key": "kibana_image_port"
},
{
"key": "kibana_system_secret_name"
},
{
"key": "kibana_app_secret_name"
},
{
"key": "cbr_rules",
"type": "array",
Expand Down
30 changes: 22 additions & 8 deletions solutions/fully-configurable/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,34 @@ locals {
}
]

# Prepare locally generated secrets
system_secrets = [{
"secret_name" = "${local.prefix}${var.admin_pass_secrets_manager_secret_name}"
"secret_type" = "arbitrary"
"secret_payload_password" = local.admin_pass
}]
kibana_secrets = var.enable_kibana_dashboard ? [{
"secret_name" = "${local.prefix}${var.kibana_system_secret_name}"
"secret_type" = "arbitrary"
"secret_payload_password" = local.kibana_system_password
},
{
"secret_name" = "${local.prefix}${var.kibana_app_secret_name}"
"secret_type" = "arbitrary"
"secret_payload_password" = local.kibana_app_login_password
}] : []
password_secrets = concat(local.system_secrets, local.kibana_secrets)


# Build the structure of the arbitrary credential type secret for admin password
admin_pass_secret = [{
user_secrets = [{
secret_group_name = "${local.prefix}${var.admin_pass_secrets_manager_secret_group}"
existing_secret_group = var.use_existing_admin_pass_secrets_manager_secret_group
secrets = [{
secret_name = "${local.prefix}${var.admin_pass_secrets_manager_secret_name}"
secret_type = "arbitrary"
secret_payload_password = local.admin_pass
}
]
secrets = local.password_secrets
}]

# Concatenate into 1 secrets object
secrets = concat(local.service_credential_secrets, local.admin_pass_secret)
secrets = concat(local.service_credential_secrets, local.user_secrets)
# Parse Secrets Manager details from the CRN
existing_secrets_manager_instance_guid = var.existing_secrets_manager_instance_crn != null ? module.sm_instance_crn_parser[0].service_instance : null
existing_secrets_manager_instance_region = var.existing_secrets_manager_instance_crn != null ? module.sm_instance_crn_parser[0].region : null
Expand Down
26 changes: 26 additions & 0 deletions solutions/fully-configurable/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,32 @@ variable "kibana_registry_personal_access_token" {
}
}

variable "kibana_system_secret_name" {
type = string
description = "The Secrets Manager secret name of a new kibana system secret. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
default = "kibana-system-password"

validation {
condition = (
!(var.enable_kibana_dashboard && var.existing_secrets_manager_instance_crn != null && length(var.kibana_system_secret_name) == 0)
)
error_message = "`kibana_system_secret_name` is required when `existing_secrets_manager_instance_crn` and `enable_kibana_dashboard` are set."
}
}

variable "kibana_app_secret_name" {
type = string
description = "The Secrets Manager secret name of a new kibana application secret. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
default = "kibana-app-password"

validation {
condition = (
!(var.enable_kibana_dashboard && var.existing_secrets_manager_instance_crn != null && length(var.kibana_app_secret_name) == 0)
)
error_message = "`kibana_app_secret_name` is required when `existing_secrets_manager_instance_crn` and `enable_kibana_dashboard` are set."
}
}

##############################################################
# Context-based restriction (CBR)
##############################################################
Expand Down
2 changes: 2 additions & 0 deletions solutions/security-enforced/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ module "elasticsearch" {
kibana_image_digest = var.kibana_image_digest
kibana_image_port = var.kibana_image_port
kibana_visibility = "local_private"
kibana_system_secret_name = var.kibana_system_secret_name
kibana_app_secret_name = var.kibana_app_secret_name
cbr_rules = var.cbr_rules
}
15 changes: 13 additions & 2 deletions solutions/security-enforced/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,26 @@ variable "kibana_image_digest" {
condition = var.kibana_image_digest == null || can(regex("^sha256:", var.kibana_image_digest))
error_message = "If provided, the value of kibana_image_digest must start with 'sha256:'."
}


}

variable "kibana_image_port" {
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"
type = number
default = 5601
}

variable "kibana_system_secret_name" {
type = string
description = "The Secrets Manager secret name of a new kibana system secret. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
default = "kibana-system-password"
}

variable "kibana_app_secret_name" {
type = string
description = "The Secrets Manager secret name of a new kibana application secret. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
default = "kibana-app-password"
}

##############################################################
# Context-based restriction (CBR)
##############################################################
Expand Down