Skip to content

Commit

Permalink
fix(security_options): interbal DB and role ARN conditional
Browse files Browse the repository at this point in the history
master_db user and pass works only if internal DB is enabled
master_user_arn works only if internal DB is disable

So, a conditional is needed to avoid terraform to fail on apply
  • Loading branch information
egarbi authored and steveteuber committed May 16, 2023
1 parent 00373e9 commit e3d8c86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data "aws_caller_identity" "current" {}

data "aws_route53_zone" "opensearch" {
name = var.cluster_domain

private_zone = var.cluster_domain_private
}

Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit e3d8c86

Please sign in to comment.