From 5059667b78d43e86bccf363f5510de1daca2b8d8 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Sat, 8 Mar 2025 23:40:44 -0500 Subject: [PATCH 1/2] support node_options --- README.md | 4 ++-- examples/collection/README.md | 4 ++-- examples/collection/versions.tf | 2 +- examples/complete/README.md | 4 ++-- examples/complete/main.tf | 10 ++++++++++ examples/complete/versions.tf | 2 +- main.tf | 19 +++++++++++++++++++ modules/collection/README.md | 4 ++-- modules/collection/versions.tf | 2 +- versions.tf | 2 +- wrappers/collection/versions.tf | 2 +- wrappers/versions.tf | 2 +- 12 files changed, 43 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 15d99d9..401c756 100644 --- a/README.md +++ b/README.md @@ -144,13 +144,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.64 | +| [aws](#requirement\_aws) | >= 5.90 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.64 | +| [aws](#provider\_aws) | >= 5.90 | ## Modules diff --git a/examples/collection/README.md b/examples/collection/README.md index d049d19..002384d 100644 --- a/examples/collection/README.md +++ b/examples/collection/README.md @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.54 | +| [aws](#requirement\_aws) | >= 5.90 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.54 | +| [aws](#provider\_aws) | >= 5.90 | ## Modules diff --git a/examples/collection/versions.tf b/examples/collection/versions.tf index cfe9e2d..0f77646 100644 --- a/examples/collection/versions.tf +++ b/examples/collection/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.54" + version = ">= 5.90" } } } diff --git a/examples/complete/README.md b/examples/complete/README.md index 316041c..bf7fbdd 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -26,13 +26,13 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.54 | +| [aws](#requirement\_aws) | >= 5.90 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.54 | +| [aws](#provider\_aws) | >= 5.90 | ## Modules diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 7550fa3..f35b4bb 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -64,6 +64,16 @@ module "opensearch" { dedicated_master_type = "c6g.large.search" instance_type = "r6g.large.search" + node_options = { + coordinator = { + node_config = { + enabled = true + count = 3 + type = "m6g.large.search" + } + } + } + zone_awareness_config = { availability_zone_count = 3 } diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index cfe9e2d..0f77646 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.54" + version = ">= 5.90" } } } diff --git a/main.tf b/main.tf index e656235..ed17a22 100644 --- a/main.tf +++ b/main.tf @@ -105,6 +105,25 @@ resource "aws_opensearch_domain" "this" { warm_enabled = try(cluster_config.value.warm_enabled, null) warm_type = try(cluster_config.value.warm_type, null) + dynamic "node_options" { + for_each = try(cluster_config.value.node_options, []) + + content { + + dynamic "node_config" { + for_each = try([node_options.value.node_config], []) + + content { + count = try(node_config.value.count, null) + enabled = try(node_config.value.enabled, null) + type = try(node_config.value.type, null) + } + } + + node_type = try(node_options.key, node_options.value.node_type, null) + } + } + dynamic "zone_awareness_config" { for_each = try(cluster_config.value.zone_awareness_enabled, true) ? try([cluster_config.value.zone_awareness_config], []) : [] diff --git a/modules/collection/README.md b/modules/collection/README.md index ca71d8e..1c9ea93 100644 --- a/modules/collection/README.md +++ b/modules/collection/README.md @@ -42,13 +42,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.54 | +| [aws](#requirement\_aws) | >= 5.90 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.54 | +| [aws](#provider\_aws) | >= 5.90 | ## Modules diff --git a/modules/collection/versions.tf b/modules/collection/versions.tf index cfe9e2d..0f77646 100644 --- a/modules/collection/versions.tf +++ b/modules/collection/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.54" + version = ">= 5.90" } } } diff --git a/versions.tf b/versions.tf index 264f62f..0f77646 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.64" + version = ">= 5.90" } } } diff --git a/wrappers/collection/versions.tf b/wrappers/collection/versions.tf index cfe9e2d..0f77646 100644 --- a/wrappers/collection/versions.tf +++ b/wrappers/collection/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.54" + version = ">= 5.90" } } } diff --git a/wrappers/versions.tf b/wrappers/versions.tf index 264f62f..0f77646 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.64" + version = ">= 5.90" } } } From 99e060f11a499da227385a1b1a01c08f7103ce5f Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Tue, 11 Mar 2025 20:58:00 -0400 Subject: [PATCH 2/2] feedback changes and key should come second in the try --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index ed17a22..3fbd3a1 100644 --- a/main.tf +++ b/main.tf @@ -115,12 +115,12 @@ resource "aws_opensearch_domain" "this" { content { count = try(node_config.value.count, null) - enabled = try(node_config.value.enabled, null) + enabled = try(node_config.value.enabled, true) type = try(node_config.value.type, null) } } - node_type = try(node_options.key, node_options.value.node_type, null) + node_type = try(node_options.value.node_type, node_options.key, null) } }