From e99558281417308b6995b5c0a81396576acd0cea Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Fri, 22 Mar 2024 12:53:34 -0400 Subject: [PATCH] add ability to disable standby replicas for collections and use off peak window in auto tune options --- README.md | 4 ++-- examples/collection/README.md | 4 ++-- examples/collection/main.tf | 7 ++++--- examples/collection/versions.tf | 2 +- examples/complete/README.md | 6 +++--- examples/complete/versions.tf | 2 +- main.tf | 1 + modules/collection/README.md | 5 +++-- modules/collection/main.tf | 7 ++++--- modules/collection/variables.tf | 6 ++++++ modules/collection/versions.tf | 2 +- versions.tf | 2 +- wrappers/collection/main.tf | 1 + 13 files changed, 30 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index dd413da..f6db3fc 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.24 | +| [aws](#requirement\_aws) | >= 5.40 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.24 | +| [aws](#provider\_aws) | >= 5.40 | ## Modules diff --git a/examples/collection/README.md b/examples/collection/README.md index 8f870f4..4b951b2 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.24 | +| [aws](#requirement\_aws) | >= 5.40 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.24 | +| [aws](#provider\_aws) | >= 5.40 | ## Modules diff --git a/examples/collection/main.tf b/examples/collection/main.tf index 245a054..ff2e17f 100644 --- a/examples/collection/main.tf +++ b/examples/collection/main.tf @@ -25,9 +25,10 @@ locals { module "opensearch_collection_public" { source = "../../modules/collection" - name = "${local.name}-public" - description = "Example public OpenSearch Serverless collection" - type = "SEARCH" + name = "${local.name}-public" + description = "Example public OpenSearch Serverless collection" + type = "SEARCH" + standby_replicas = "DISABLED" create_access_policy = true create_network_policy = true diff --git a/examples/collection/versions.tf b/examples/collection/versions.tf index a9c2eed..afb4445 100644 --- a/examples/collection/versions.tf +++ b/examples/collection/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.24" + version = ">= 5.40" } } } diff --git a/examples/complete/README.md b/examples/complete/README.md index 8f57018..4003335 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -1,6 +1,6 @@ # Complete AWS OpenSearch Example -Configuration in this directory creates an AWS OpenSEarch domain and resources +Configuration in this directory creates an AWS OpenSearch domain and resources ## Usage @@ -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.24 | +| [aws](#requirement\_aws) | >= 5.40 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.24 | +| [aws](#provider\_aws) | >= 5.40 | ## Modules diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index a9c2eed..afb4445 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.24" + version = ">= 5.40" } } } diff --git a/main.tf b/main.tf index 3a5dfdd..f0a152c 100644 --- a/main.tf +++ b/main.tf @@ -79,6 +79,7 @@ resource "aws_opensearch_domain" "this" { } rollback_on_disable = try(auto_tune_options.value.rollback_on_disable, null) + use_off_peak_window = try(auto_tune_options.value.use_off_peak_window, null) } } diff --git a/modules/collection/README.md b/modules/collection/README.md index 5346c12..803ec32 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.24 | +| [aws](#requirement\_aws) | >= 5.40 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.24 | +| [aws](#provider\_aws) | >= 5.40 | ## Modules @@ -92,6 +92,7 @@ No modules. | [network\_policy](#input\_network\_policy) | Network policy to apply to the collection | `any` | `{}` | no | | [network\_policy\_description](#input\_network\_policy\_description) | Description of the network policy | `string` | `null` | no | | [network\_policy\_name](#input\_network\_policy\_name) | Name of the network policy | `string` | `null` | no | +| [standby\_replicas](#input\_standby\_replicas) | Indicates whether standby replicas should be used for a collection. One of ENABLED or DISABLED. Defaults to ENABLED. | `string` | `null` | no | | [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no | | [timeouts](#input\_timeouts) | Create and delete timeout configurations for the collection | `map(string)` | `{}` | no | | [type](#input\_type) | Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES` | `string` | `null` | no | diff --git a/modules/collection/main.tf b/modules/collection/main.tf index 7b5b1e6..7e6d70d 100644 --- a/modules/collection/main.tf +++ b/modules/collection/main.tf @@ -13,9 +13,10 @@ locals { resource "aws_opensearchserverless_collection" "this" { count = var.create ? 1 : 0 - description = var.description - name = var.name - type = var.type + description = var.description + name = var.name + type = var.type + standby_replicas = var.standby_replicas tags = local.tags diff --git a/modules/collection/variables.tf b/modules/collection/variables.tf index a463c31..c535934 100644 --- a/modules/collection/variables.tf +++ b/modules/collection/variables.tf @@ -32,6 +32,12 @@ variable "type" { default = null } +variable "standby_replicas" { + description = "Indicates whether standby replicas should be used for a collection. One of ENABLED or DISABLED. Defaults to ENABLED." + type = string + default = null +} + variable "timeouts" { description = "Create and delete timeout configurations for the collection" type = map(string) diff --git a/modules/collection/versions.tf b/modules/collection/versions.tf index a9c2eed..afb4445 100644 --- a/modules/collection/versions.tf +++ b/modules/collection/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.24" + version = ">= 5.40" } } } diff --git a/versions.tf b/versions.tf index a9c2eed..afb4445 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.24" + version = ">= 5.40" } } } diff --git a/wrappers/collection/main.tf b/wrappers/collection/main.tf index 30052fe..78dea79 100644 --- a/wrappers/collection/main.tf +++ b/wrappers/collection/main.tf @@ -26,6 +26,7 @@ module "wrapper" { network_policy = try(each.value.network_policy, var.defaults.network_policy, {}) network_policy_description = try(each.value.network_policy_description, var.defaults.network_policy_description, null) network_policy_name = try(each.value.network_policy_name, var.defaults.network_policy_name, null) + standby_replicas = try(each.value.standby_replicas, var.defaults.standby_replicas, null) tags = try(each.value.tags, var.defaults.tags, {}) timeouts = try(each.value.timeouts, var.defaults.timeouts, {}) type = try(each.value.type, var.defaults.type, null)