File tree 2 files changed +7
-23
lines changed 2 files changed +7
-23
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ locals {
22
22
static_domain_arn = " arn:${ local . partition } :es:${ local . region } :${ local . account_id } :domain/${ var . domain_name } "
23
23
24
24
tags = merge (var. tags , { terraform-aws-modules = " opensearch" })
25
+
26
+ name = " es-${ var . application_name } "
25
27
}
26
28
27
29
# ###############################################################################
@@ -458,9 +460,9 @@ module "elasticsearch_secret" {
458
460
resource_tags = var. tags
459
461
460
462
initial_value = jsonencode ({
461
- ES_ENDPOINT = module.opensearch [0 ].domain_endpoint
462
- ES_DASHBOARD_ENDPOINT = module.opensearch [0 ].domain_dashboard_endpoint
463
- ES_DOMAIN_ID = module.opensearch [0 ].domain_id
464
- ES_PASSWORD = random_password.es.result
463
+ ES_ENDPOINT = try (aws_opensearch_domain . this [0 ]. endpoint , null )
464
+ ES_DASHBOARD_ENDPOINT = try (aws_opensearch_domain . this [0 ]. dashboard_endpoint , null )
465
+ ES_DOMAIN_ID = try (aws_opensearch_domain . this [0 ]. domain_id , null )
466
+ ES_PASSWORD = var.advanced_security_options.master_user_options.master_user_password
465
467
})
466
468
}
Original file line number Diff line number Diff line change @@ -146,24 +146,6 @@ resource "random_password" "es" {
146
146
special = false
147
147
}
148
148
149
- module "elasticsearch_secret" {
150
- count = var. elasticsearch_enabled ? 1 : 0
151
- source = " github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.4.0"
152
-
153
- admin_principals = var. admin_principals
154
- description = " Elastisearch secrets for: ${ local . name } "
155
- name = " ${ local . name } -secret"
156
- read_principals = var. read_principals
157
- resource_tags = var. tags
158
-
159
- initial_value = jsonencode ({
160
- ES_ENDPOINT = module.opensearch[0 ].domain_endpoint
161
- ES_DASHBOARD_ENDPOINT = module.opensearch[0 ].domain_dashboard_endpoint
162
- ES_DOMAIN_ID = module.opensearch[0 ].domain_id
163
- ES_PASSWORD = random_password.es.result
164
- })
165
- }
166
-
167
149
resource "aws_iam_role_policy_attachment" "test-attach" {
168
150
count = var. elasticsearch_enabled ? 1 : 0
169
151
@@ -173,7 +155,7 @@ resource "aws_iam_role_policy_attachment" "test-attach" {
173
155
depends_on = [module . pod_policy ]
174
156
}
175
157
176
- module "pod_policy " {
158
+ module "es_pod_policy " {
177
159
count = var. elasticsearch_enabled ? 1 : 0
178
160
source = " github.com/thoughtbot/flightdeck//aws/service-account-policy?ref=v0.9.0"
179
161
You can’t perform that action at this time.
0 commit comments