Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
234eb66
feat: added kibana dashboard
Ak-sky Oct 5, 2024
21bcb03
feat: added kibana dashboard
Ak-sky Oct 7, 2024
220bb57
feat: added kibana dashboard
Ak-sky Oct 7, 2024
1550d47
feat: added kibana dashboard
Ak-sky Oct 8, 2024
7ba5bce
feat: added kibana dashboard
Ak-sky Oct 9, 2024
695a54c
Merge branch 'main' into es-kibana
Ak-sky Oct 9, 2024
9155799
addressed review comments
Ak-sky Oct 16, 2024
c28bffc
addressed review comments
Ak-sky Oct 16, 2024
33fbda3
addressed review comments
Ak-sky Oct 16, 2024
26cfe72
updated test
Ak-sky Oct 16, 2024
c8fb49e
addressed review comments
Ak-sky Oct 16, 2024
9f5d4a7
datalook up only on kibana deployment
Ak-sky Oct 17, 2024
46748da
datalook up only on kibana deployment
Ak-sky Oct 17, 2024
d0db4c1
updated test to use us-south for basic ex
Ak-sky Oct 18, 2024
a344144
Revert "datalook up only on kibana deployment"
Ak-sky Oct 19, 2024
3b2bb7a
updated test
Ak-sky Oct 19, 2024
669e1ca
addressed review comments
Ak-sky Oct 21, 2024
06c8344
addressed review comments
Ak-sky Oct 22, 2024
f752685
addressed review comments
Ak-sky Oct 22, 2024
0362e52
addressed review comments
Ak-sky Oct 22, 2024
620a2b2
basic test to use us-south
Ak-sky Oct 23, 2024
3720c89
Revert "basic test to use us-south"
Ak-sky Oct 23, 2024
e15e74c
commented index and cluster sett. in basic ex
Ak-sky Oct 23, 2024
0b5b9d7
Merge branch 'main' into es-kibana
Ak-sky Nov 3, 2024
29ddc64
addressed review comments
Ak-sky Nov 5, 2024
edb1543
addressed review comments
Ak-sky Nov 5, 2024
43eb743
fix: variable name
vburckhardt Nov 6, 2024
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
1 change: 1 addition & 0 deletions solutions/standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This architecture creates an instance of IBM Cloud Databases for Elasticsearch a
- A KMS root key, if one is not passed in.
- An IBM Cloud Databases for Elasticsearch instance with KMS encryption.
- Autoscaling rules for the database instance, if provided.
- Kibana dashboard for Elasticsearch.

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

Expand Down
80 changes: 80 additions & 0 deletions solutions/standard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,83 @@ data "ibm_database_connection" "existing_connection" {
user_id = data.ibm_database.existing_db_instance[0].adminuser
user_type = "database"
}

########################################################################################################################
# Code Engine Kibana Dashboard instance
########################################################################################################################

data "http" "es_metadata" {
url = "https://${local.es_username}:${local.es_password}@${local.es_host}:${local.es_port}"
insecure = true
}

locals {

# code_engine_project_name = var.prefix != null ? "${var.prefix}-code-engine-kibana-project" : "ce-kibana-project"
code_engine_project_name = var.code_engine_project_name != null ? var.code_engine_project_name : var.prefix != null ? "${var.prefix}-code-engine-kibana-project" : "ce-kibana-project"
code_engine_app_name = var.prefix != null ? "${var.prefix}-kibana-app" : "ce-kibana-app"

es_host = local.use_existing_db_instance ? data.ibm_database_connection.existing_connection[0].https[0].hosts[0].hostname : module.elasticsearch[0].hostname
es_port = local.use_existing_db_instance ? data.ibm_database_connection.existing_connection[0].https[0].hosts[0].port : module.elasticsearch[0].port
es_username = local.use_existing_db_instance ? data.ibm_database.existing_db_instance[0].adminuser : "admin"
es_password = local.admin_pass
es_data = jsondecode(data.http.es_metadata.response_body)
es_full_version = var.es_full_version != null ? var.es_full_version : local.es_data.version.number
}

module "code_engine_kibana" {
count = var.enable_kibana_dashboard ? 1 : 0
source = "terraform-ibm-modules/code-engine/ibm"
version = "2.0.4"
resource_group_id = module.resource_group.resource_group_id
project_name = local.code_engine_project_name
secrets = {
"es-secret" = {
format = "generic"
data = {
"ELASTICSEARCH_PASSWORD" = local.es_password
}
}
}

apps = {
(local.code_engine_app_name) = {
image_reference = "docker.elastic.co/kibana/kibana:${local.es_full_version}"
image_port = 5601
run_env_variables = [{
type = "literal"
name = "ELASTICSEARCH_HOSTS"
value = "[\"https://${local.es_host}:${local.es_port}\"]"
},
{
type = "literal"
name = "ELASTICSEARCH_USERNAME"
value = local.es_username
},
{
type = "secret_key_reference"
name = "ELASTICSEARCH_PASSWORD"
key = "ELASTICSEARCH_PASSWORD"
reference = "es-secret"
},
{
type = "literal"
name = "ELASTICSEARCH_SSL_ENABLED"
value = "true"
},
{
type = "literal"
name = "SERVER_HOST"
value = "0.0.0.0"
},
{
type = "literal"
name = "ELASTICSEARCH_SSL_VERIFICATIONMODE"
value = "none"
}
]
scale_min_instances = 1
scale_max_instances = 3
}
}
}
5 changes: 5 additions & 0 deletions solutions/standard/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ output "admin_pass" {
value = local.admin_pass
sensitive = true
}

output "kibana_app_endpoint" {
description = "Code Engine Kibana endpoint URL"
value = var.enable_kibana_dashboard ? module.code_engine_kibana[0].app[local.code_engine_app_name].endpoint : null
}
22 changes: 22 additions & 0 deletions solutions/standard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,25 @@ variable "admin_pass_sm_secret_name" {
description = "The name of a new elasticsearch administrator secret. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
default = "elasticsearch-admin-password"
}

##############################################################
# Kibana Configuration
##############################################################

variable "code_engine_project_name" {
description = "Name of the code engine project to deploy the Kibana app. If no value is passed, a new code engine project will be created."
type = string
default = null
}

variable "enable_kibana_dashboard" {
type = bool
description = "Set it true to deploy Kibana dashboard for Elasticsearch instance. NOTE: Kibana image is coming direcly from the official registry (https://www.docker.elastic.co/) and not certified by the IBM."
default = false
}

variable "es_full_version" {
description = "Full version of the Elasticsearch instance in the format `x.x.x` to deploy Kibana dashboard."
type = string
default = null
}
4 changes: 4 additions & 0 deletions solutions/standard/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ terraform {
source = "hashicorp/random"
version = "3.6.3"
}
http = {
source = "hashicorp/http"
version = "3.4.5"
}
}
}
2 changes: 2 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
{Name: "service_credential_secrets", Value: serviceCredentialSecrets, DataType: "list(object)"},
{Name: "admin_pass_sm_secret_group", Value: options.Prefix, DataType: "string"},
{Name: "admin_pass_sm_secret_name", Value: options.Prefix, DataType: "string"},
{Name: "enable_kibana_dashboard", Value: true, DataType: "bool"},
{Name: "code_engine_project_name", Value: options.Prefix, DataType: "string"},
}
err := options.RunSchematicTest()
assert.Nil(t, err, "This should not have errored")
Expand Down