diff --git a/data.tf b/data.tf index c7a6711..6e51f8d 100644 --- a/data.tf +++ b/data.tf @@ -4,7 +4,7 @@ data "aws_caller_identity" "current" {} data "aws_route53_zone" "opensearch" { name = var.cluster_domain - + private_zone = var.cluster_domain_private } diff --git a/main.tf b/main.tf index 5491cca..0934606 100644 --- a/main.tf +++ b/main.tf @@ -56,9 +56,9 @@ resource "aws_elasticsearch_domain" "opensearch" { internal_user_database_enabled = var.advanced_security_options_internal_user_database_enabled master_user_options { - master_user_arn = (var.master_user_arn != "") ? var.master_user_arn : data.aws_caller_identity.current.arn - master_user_name = var.advanced_security_options_master_user_name - master_user_password = var.advanced_security_options_master_user_password + master_user_arn = var.advanced_security_options_internal_user_database_enabled ? null : (var.master_user_arn != "" ? var.master_user_arn : data.aws_caller_identity.current.arn) + master_user_name = var.advanced_security_options_internal_user_database_enabled ? var.advanced_security_options_master_user_name : null + master_user_password = var.advanced_security_options_internal_user_database_enabled ? var.advanced_security_options_master_user_password : null } } }