Skip to content

Commit 99139a6

Browse files
committed
feat(terraform): add SAML options for ES and OpenSearch domains
Refactored SAML options resources to support both Elasticsearch and OpenSearch domains. Added conditional logic to create the appropriate resource based on the selected AWS service type. Updated resource names and configuration to ensure compatibility and flexibility for both services.
1 parent 7ce2c1b commit 99139a6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/main.tf

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,23 @@ module "elasticsearch" {
5656
context = module.this.context
5757
}
5858

59-
resource "aws_opensearch_domain_saml_options" "this" {
60-
count = local.saml_options_enabled ? 1 : 0
59+
resource "aws_elasticsearch_domain_saml_options" "elasticsearch" {
60+
count = local.saml_options_enabled && var.aws_service_type == "elasticsearch" ? 1 : 0
6161

6262
domain_name = module.elasticsearch.domain_name
63+
saml_options {
64+
enabled = var.elasticsearch_saml_options.enabled
65+
idp {
66+
entity_id = var.elasticsearch_saml_options.entity_id
67+
metadata_content = var.elasticsearch_saml_options.metadata_content
68+
}
69+
}
70+
}
6371

72+
resource "aws_opensearch_domain_saml_options" "opensearch" {
73+
count = local.saml_options_enabled && var.aws_service_type == "opensearch" ? 1 : 0
74+
75+
domain_name = module.elasticsearch.domain_name
6476
saml_options {
6577
enabled = var.elasticsearch_saml_options.enabled
6678
idp {

0 commit comments

Comments
 (0)