Skip to content

Commit

Permalink
add ability to disable standby replicas for collections and use off p…
Browse files Browse the repository at this point in the history
…eak window in auto tune options
  • Loading branch information
magreenbaum committed Mar 22, 2024
1 parent 5ee6eeb commit e995582
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.24 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.24 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.24 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.24 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |

## Modules

Expand Down
7 changes: 4 additions & 3 deletions examples/collection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/collection/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.24"
version = ">= 5.40"
}
}
}
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -26,13 +26,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.24 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.24 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.24"
version = ">= 5.40"
}
}
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
5 changes: 3 additions & 2 deletions modules/collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.24 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.24 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |

## Modules

Expand Down Expand Up @@ -92,6 +92,7 @@ No modules.
| <a name="input_network_policy"></a> [network\_policy](#input\_network\_policy) | Network policy to apply to the collection | `any` | `{}` | no |
| <a name="input_network_policy_description"></a> [network\_policy\_description](#input\_network\_policy\_description) | Description of the network policy | `string` | `null` | no |
| <a name="input_network_policy_name"></a> [network\_policy\_name](#input\_network\_policy\_name) | Name of the network policy | `string` | `null` | no |
| <a name="input_standby_replicas"></a> [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 |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | Create and delete timeout configurations for the collection | `map(string)` | `{}` | no |
| <a name="input_type"></a> [type](#input\_type) | Type of collection. One of `SEARCH`, `TIMESERIES`, or `VECTORSEARCH`. Defaults to `TIMESERIES` | `string` | `null` | no |
Expand Down
7 changes: 4 additions & 3 deletions modules/collection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions modules/collection/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion modules/collection/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.24"
version = ">= 5.40"
}
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.24"
version = ">= 5.40"
}
}
}
1 change: 1 addition & 0 deletions wrappers/collection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e995582

Please sign in to comment.