Skip to content

Commit b7ab787

Browse files
authored
feat: Opensearch Domain ip_address_type, Cloudwatch log_group_class, and skip_destroy (#13)
1 parent f479250 commit b7ab787

File tree

12 files changed

+48
-14
lines changed

12 files changed

+48
-14
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
144144
| Name | Version |
145145
|------|---------|
146146
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
147-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |
147+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.54 |
148148

149149
## Providers
150150

151151
| Name | Version |
152152
|------|---------|
153-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |
153+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.54 |
154154

155155
## Modules
156156

@@ -190,8 +190,10 @@ No modules.
190190
| <a name="input_advanced_options"></a> [advanced\_options](#input\_advanced\_options) | Key-value string pairs to specify advanced configuration options. Note that the values for these configuration options must be strings (wrapped in quotes) or they may be wrong and cause a perpetual diff, causing Terraform to want to recreate your Elasticsearch domain on every apply | `map(string)` | `{}` | no |
191191
| <a name="input_advanced_security_options"></a> [advanced\_security\_options](#input\_advanced\_security\_options) | Configuration block for [fine-grained access control](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/fgac.html) | `any` | <pre>{<br> "anonymous_auth_enabled": false,<br> "enabled": true<br>}</pre> | no |
192192
| <a name="input_auto_tune_options"></a> [auto\_tune\_options](#input\_auto\_tune\_options) | Configuration block for the Auto-Tune options of the domain | `any` | <pre>{<br> "desired_state": "ENABLED",<br> "rollback_on_disable": "NO_ROLLBACK"<br>}</pre> | no |
193+
| <a name="input_cloudwatch_log_group_class"></a> [cloudwatch\_log\_group\_class](#input\_cloudwatch\_log\_group\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\_ACCESS | `string` | `null` | no |
193194
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html) | `string` | `null` | no |
194195
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | Number of days to retain log events | `number` | `60` | no |
196+
| <a name="input_cloudwatch_log_group_skip_destroy"></a> [cloudwatch\_log\_group\_skip\_destroy](#input\_cloudwatch\_log\_group\_skip\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `null` | no |
195197
| <a name="input_cloudwatch_log_resource_policy_name"></a> [cloudwatch\_log\_resource\_policy\_name](#input\_cloudwatch\_log\_resource\_policy\_name) | Name of the resource policy for OpenSearch to log to CloudWatch | `string` | `null` | no |
196198
| <a name="input_cluster_config"></a> [cluster\_config](#input\_cluster\_config) | Configuration block for the cluster of the domain | `any` | <pre>{<br> "dedicated_master_enabled": true<br>}</pre> | no |
197199
| <a name="input_cognito_options"></a> [cognito\_options](#input\_cognito\_options) | Configuration block for authenticating Kibana with Cognito | `any` | `{}` | no |
@@ -207,6 +209,7 @@ No modules.
207209
| <a name="input_enable_access_policy"></a> [enable\_access\_policy](#input\_enable\_access\_policy) | Determines whether an access policy will be applied to the domain | `bool` | `true` | no |
208210
| <a name="input_encrypt_at_rest"></a> [encrypt\_at\_rest](#input\_encrypt\_at\_rest) | Configuration block for encrypting at rest | `any` | <pre>{<br> "enabled": true<br>}</pre> | no |
209211
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Version of the OpenSearch engine to use | `string` | `null` | no |
212+
| <a name="input_ip_address_type"></a> [ip\_address\_type](#input\_ip\_address\_type) | The IP address type for the endpoint. Valid values are ipv4 and dualstack | `string` | `null` | no |
210213
| <a name="input_log_publishing_options"></a> [log\_publishing\_options](#input\_log\_publishing\_options) | Configuration block for publishing slow and application logs to CloudWatch Logs. This block can be declared multiple times, for each log\_type, within the same resource | `any` | <pre>[<br> {<br> "log_type": "INDEX_SLOW_LOGS"<br> },<br> {<br> "log_type": "SEARCH_SLOW_LOGS"<br> }<br>]</pre> | no |
211214
| <a name="input_node_to_node_encryption"></a> [node\_to\_node\_encryption](#input\_node\_to\_node\_encryption) | Configuration block for node-to-node encryption options | `any` | <pre>{<br> "enabled": true<br>}</pre> | no |
212215
| <a name="input_off_peak_window_options"></a> [off\_peak\_window\_options](#input\_off\_peak\_window\_options) | Configuration to add Off Peak update options | `any` | <pre>{<br> "enabled": true,<br> "off_peak_window": {<br> "hours": 7<br> }<br>}</pre> | no |

examples/collection/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.54 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.54 |
3030

3131
## Modules
3232

examples/collection/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.40"
7+
version = ">= 5.54"
88
}
99
}
1010
}

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ Note that this example may create resources which will incur monetary charges on
2626
| Name | Version |
2727
|------|---------|
2828
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
29-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |
29+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.54 |
3030

3131
## Providers
3232

3333
| Name | Version |
3434
|------|---------|
35-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |
35+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.54 |
3636

3737
## Modules
3838

examples/complete/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ module "opensearch" {
9797
{ log_type = "SEARCH_SLOW_LOGS" },
9898
]
9999

100+
ip_address_type = "dualstack"
101+
100102
node_to_node_encryption = {
101103
enabled = true
102104
}
@@ -172,5 +174,10 @@ module "vpc" {
172174
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
173175
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 10)]
174176

177+
enable_ipv6 = true
178+
179+
public_subnet_ipv6_prefixes = [0, 1, 2]
180+
private_subnet_ipv6_prefixes = [3, 4, 5]
181+
175182
tags = local.tags
176183
}

examples/complete/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.40"
7+
version = ">= 5.54"
88
}
99
}
1010
}

main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ resource "aws_opensearch_domain" "this" {
163163
}
164164
}
165165

166-
engine_version = var.engine_version
166+
engine_version = var.engine_version
167+
ip_address_type = var.ip_address_type
167168

168169
dynamic "log_publishing_options" {
169170
for_each = { for opt in var.log_publishing_options : opt.log_type => opt }
@@ -402,6 +403,8 @@ resource "aws_cloudwatch_log_group" "this" {
402403
name = try(each.value.log_group_name, "/aws/opensearch/${var.domain_name}/${each.key}")
403404
retention_in_days = try(each.value.log_group_retention_in_days, var.cloudwatch_log_group_retention_in_days)
404405
kms_key_id = try(each.value.log_group_kms_key_id, var.cloudwatch_log_group_kms_key_id)
406+
skip_destroy = try(each.value.log_group_skip_destroy, var.cloudwatch_log_group_skip_destroy)
407+
log_group_class = try(each.value.log_group_class, var.cloudwatch_log_group_class)
405408

406409
tags = merge(local.tags, try(each.value.log_group_tags, {}))
407410
}

modules/collection/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
4242
| Name | Version |
4343
|------|---------|
4444
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
45-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.40 |
45+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.54 |
4646

4747
## Providers
4848

4949
| Name | Version |
5050
|------|---------|
51-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.40 |
51+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.54 |
5252

5353
## Modules
5454

modules/collection/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.40"
7+
version = ">= 5.54"
88
}
99
}
1010
}

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ variable "engine_version" {
9191
default = null
9292
}
9393

94+
variable "ip_address_type" {
95+
description = "The IP address type for the endpoint. Valid values are ipv4 and dualstack"
96+
type = string
97+
default = null
98+
}
99+
94100
variable "log_publishing_options" {
95101
description = "Configuration block for publishing slow and application logs to CloudWatch Logs. This block can be declared multiple times, for each log_type, within the same resource"
96102
type = any
@@ -241,6 +247,18 @@ variable "cloudwatch_log_group_kms_key_id" {
241247
default = null
242248
}
243249

250+
variable "cloudwatch_log_group_skip_destroy" {
251+
description = "Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state"
252+
type = bool
253+
default = null
254+
}
255+
256+
variable "cloudwatch_log_group_class" {
257+
description = "Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS"
258+
type = string
259+
default = null
260+
}
261+
244262
variable "create_cloudwatch_log_resource_policy" {
245263
description = "Determines whether a resource policy will be created for OpenSearch to log to CloudWatch"
246264
type = bool

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.40"
7+
version = ">= 5.54"
88
}
99
}
1010
}

wrappers/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ module "wrapper" {
1616
desired_state = "ENABLED"
1717
rollback_on_disable = "NO_ROLLBACK"
1818
})
19+
cloudwatch_log_group_class = try(each.value.cloudwatch_log_group_class, var.defaults.cloudwatch_log_group_class, null)
1920
cloudwatch_log_group_kms_key_id = try(each.value.cloudwatch_log_group_kms_key_id, var.defaults.cloudwatch_log_group_kms_key_id, null)
2021
cloudwatch_log_group_retention_in_days = try(each.value.cloudwatch_log_group_retention_in_days, var.defaults.cloudwatch_log_group_retention_in_days, 60)
22+
cloudwatch_log_group_skip_destroy = try(each.value.cloudwatch_log_group_skip_destroy, var.defaults.cloudwatch_log_group_skip_destroy, null)
2123
cloudwatch_log_resource_policy_name = try(each.value.cloudwatch_log_resource_policy_name, var.defaults.cloudwatch_log_resource_policy_name, null)
2224
cluster_config = try(each.value.cluster_config, var.defaults.cluster_config, {
2325
dedicated_master_enabled = true
@@ -43,7 +45,8 @@ module "wrapper" {
4345
encrypt_at_rest = try(each.value.encrypt_at_rest, var.defaults.encrypt_at_rest, {
4446
enabled = true
4547
})
46-
engine_version = try(each.value.engine_version, var.defaults.engine_version, null)
48+
engine_version = try(each.value.engine_version, var.defaults.engine_version, null)
49+
ip_address_type = try(each.value.ip_address_type, var.defaults.ip_address_type, null)
4750
log_publishing_options = try(each.value.log_publishing_options, var.defaults.log_publishing_options, [
4851
{ log_type = "INDEX_SLOW_LOGS" },
4952
{ log_type = "SEARCH_SLOW_LOGS" },

0 commit comments

Comments
 (0)