Skip to content

Commit bdfc996

Browse files
committed
updated namespace condition
1 parent dbaab22 commit bdfc996

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,35 @@ This module is for deploying a highly available MongoDB cluster on Kubernetes us
1818
## Usage Example
1919

2020
```hcl
21-
module "aws" {
22-
source = "squareops/mongodb/kubernetes//modules/resources/aws"
23-
environment = "prod"
24-
name = "mongodb"
25-
cluster_name = "prod-eks"
26-
mongodb_custom_credentials_enabled = "true"
27-
store_password_to_secret_manager = "true"
28-
mongodb_custom_credentials_config = {
21+
locals {
22+
name = "mongo"
23+
region = "us-east-2"
24+
environment = "prod"
25+
additional_tags = {
26+
Owner = "organization_name"
27+
Expires = "Never"
28+
Department = "Engineering"
29+
}
30+
create_namespace = true
31+
namespace = "mongodb"
32+
store_password_to_secret_manager = true
33+
mongodb_custom_credentials_enabled = true
34+
mongodb_custom_credentials_config = {
2935
root_user = "root"
3036
root_password = "NCPFUKEMd7rrWuvMAa73"
3137
metric_exporter_user = "mongodb_exporter"
3238
metric_exporter_password = "nvAHhm1uGQNYWVw6ZyAH"
3339
}
3440
}
41+
module "aws" {
42+
source = "squareops/mongodb/kubernetes//modules/resources/aws"
43+
environment = local.environment
44+
name = local.name
45+
store_password_to_secret_manager = local.store_password_to_secret_manager
46+
cluster_name = ""
47+
mongodb_custom_credentials_enabled = local.mongodb_custom_credentials_enabled
48+
mongodb_custom_credentials_config = local.mongodb_custom_credentials_config
49+
}
3550
3651
module "mongodb" {
3752
source = "squareops/mongodb/kubernetes"
@@ -40,7 +55,7 @@ module "mongodb" {
4055
mongodb_config = {
4156
name = local.name
4257
namespace = local.namespace
43-
values_yaml = file("./helm/values.yaml")
58+
values_yaml = ""
4459
environment = local.environment
4560
volume_size = "10Gi"
4661
architecture = "replicaset"

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "helm_release" "mongodb" {
3232
repository = "https://charts.bitnami.com/bitnami"
3333
values = [
3434
templatefile("${path.module}/helm/values/mongodb/values.yaml", {
35-
namespace = var.create_namespace ? var.namespace : "default",
35+
namespace = var.namespace,
3636
app_version = var.app_version,
3737
volume_size = var.mongodb_config.volume_size,
3838
architecture = var.mongodb_config.architecture,

output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ output "mongodb_endpoints" {
22
description = "MongoDB endpoints in the Kubernetes cluster."
33
value = {
44
mongoport = "27017",
5-
mongodb_endpoint = var.create_namespace ? "mongodb-headless.${var.namespace}.svc.cluster.local" : "mongodb-headless.default.svc.cluster.local"
5+
mongodb_endpoint = "mongodb-headless.${var.namespace}.svc.cluster.local"
66
}
77
}
88

0 commit comments

Comments
 (0)