Skip to content

Commit 5b2f7ed

Browse files
authored
Merge branch 'master' into cold-storage-support
2 parents f088595 + 7f83b65 commit 5b2f7ed

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ Available targets:
214214
| <a name="input_advanced_security_options_master_user_password"></a> [advanced\_security\_options\_master\_user\_password](#input\_advanced\_security\_options\_master\_user\_password) | Master user password (applicable if advanced\_security\_options\_internal\_user\_database\_enabled set to true) | `string` | `""` | no |
215215
| <a name="input_allowed_cidr_blocks"></a> [allowed\_cidr\_blocks](#input\_allowed\_cidr\_blocks) | List of CIDR blocks to be allowed to connect to the cluster | `list(string)` | `[]` | no |
216216
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
217+
| <a name="input_auto_tune"></a> [auto\_tune](#input\_auto\_tune) | This object represents the auto\_tune configuration. It contains the following filed:<br>- enabled - Whether to enable autotune.<br>- rollback\_on\_disable - Whether to roll back to default Auto-Tune settings when disabling Auto-Tune.<br>- starting\_time - Date and time at which to start the Auto-Tune maintenance schedule in RFC3339 format. Time should be in the future.<br>- cron\_schedule - A cron expression specifying the recurrence pattern for an Auto-Tune maintenance schedule.<br>- duration - Autotune maintanance window duration time in hours. | <pre>object({<br> enabled = bool<br> rollback_on_disable = string<br> starting_time = string<br> cron_schedule = string<br> duration = number<br> })</pre> | <pre>{<br> "cron_schedule": null,<br> "duration": null,<br> "enabled": false,<br> "rollback_on_disable": "NO_ROLLBACK",<br> "starting_time": null<br>}</pre> | no |
217218
| <a name="input_automated_snapshot_start_hour"></a> [automated\_snapshot\_start\_hour](#input\_automated\_snapshot\_start\_hour) | Hour at which automated snapshots are taken, in UTC | `number` | `0` | no |
218219
| <a name="input_availability_zone_count"></a> [availability\_zone\_count](#input\_availability\_zone\_count) | Number of Availability Zones for the domain to use. | `number` | `2` | no |
219220
| <a name="input_aws_ec2_service_name"></a> [aws\_ec2\_service\_name](#input\_aws\_ec2\_service\_name) | AWS EC2 Service Name | `list(string)` | <pre>[<br> "ec2.amazonaws.com"<br>]</pre> | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
| <a name="input_advanced_security_options_master_user_password"></a> [advanced\_security\_options\_master\_user\_password](#input\_advanced\_security\_options\_master\_user\_password) | Master user password (applicable if advanced\_security\_options\_internal\_user\_database\_enabled set to true) | `string` | `""` | no |
5252
| <a name="input_allowed_cidr_blocks"></a> [allowed\_cidr\_blocks](#input\_allowed\_cidr\_blocks) | List of CIDR blocks to be allowed to connect to the cluster | `list(string)` | `[]` | no |
5353
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
54+
| <a name="input_auto_tune"></a> [auto\_tune](#input\_auto\_tune) | This object represents the auto\_tune configuration. It contains the following filed:<br>- enabled - Whether to enable autotune.<br>- rollback\_on\_disable - Whether to roll back to default Auto-Tune settings when disabling Auto-Tune.<br>- starting\_time - Date and time at which to start the Auto-Tune maintenance schedule in RFC3339 format. Time should be in the future.<br>- cron\_schedule - A cron expression specifying the recurrence pattern for an Auto-Tune maintenance schedule.<br>- duration - Autotune maintanance window duration time in hours. | <pre>object({<br> enabled = bool<br> rollback_on_disable = string<br> starting_time = string<br> cron_schedule = string<br> duration = number<br> })</pre> | <pre>{<br> "cron_schedule": null,<br> "duration": null,<br> "enabled": false,<br> "rollback_on_disable": "NO_ROLLBACK",<br> "starting_time": null<br>}</pre> | no |
5455
| <a name="input_automated_snapshot_start_hour"></a> [automated\_snapshot\_start\_hour](#input\_automated\_snapshot\_start\_hour) | Hour at which automated snapshots are taken, in UTC | `number` | `0` | no |
5556
| <a name="input_availability_zone_count"></a> [availability\_zone\_count](#input\_availability\_zone\_count) | Number of Availability Zones for the domain to use. | `number` | `2` | no |
5657
| <a name="input_aws_ec2_service_name"></a> [aws\_ec2\_service\_name](#input\_aws\_ec2\_service\_name) | AWS EC2 Service Name | `list(string)` | <pre>[<br> "ec2.amazonaws.com"<br>]</pre> | no |

main.tf

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,23 @@ resource "aws_elasticsearch_domain" "default" {
163163
}
164164
}
165165

166+
dynamic "auto_tune_options" {
167+
for_each = var.auto_tune.enabled ? [true] : []
168+
content {
169+
desired_state = "ENABLED"
170+
rollback_on_disable = var.auto_tune.rollback_on_disable
171+
maintenance_schedule {
172+
# Required until https://github.com/hashicorp/terraform-provider-aws/issues/22239 would be resolved
173+
start_at = var.auto_tune.starting_time == null ? timeadd(timestamp(), "1h") : var.auto_tune.starting_time
174+
duration {
175+
value = var.auto_tune.duration
176+
unit = "HOURS"
177+
}
178+
cron_expression_for_recurrence = var.auto_tune_cron_schedule
179+
}
180+
}
181+
}
182+
166183
node_to_node_encryption {
167184
enabled = var.node_to_node_encryption_enabled
168185
}
@@ -300,4 +317,4 @@ module "kibana_hostname" {
300317
records = [join("", aws_elasticsearch_domain.default.*.endpoint)]
301318

302319
context = module.this.context
303-
}
320+
}

variables.tf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,46 @@ variable "cold_storage_enabled" {
369369
description = "Enables cold storage support."
370370
default = false
371371
}
372+
373+
variable "auto_tune" {
374+
type = object({
375+
enabled = bool
376+
rollback_on_disable = string
377+
starting_time = string
378+
cron_schedule = string
379+
duration = number
380+
})
381+
382+
default = {
383+
enabled = false
384+
rollback_on_disable = "NO_ROLLBACK"
385+
starting_time = null
386+
cron_schedule = null
387+
duration = null
388+
}
389+
390+
description = <<-EOT
391+
This object represents the auto_tune configuration. It contains the following filed:
392+
- enabled - Whether to enable autotune.
393+
- rollback_on_disable - Whether to roll back to default Auto-Tune settings when disabling Auto-Tune.
394+
- starting_time - Date and time at which to start the Auto-Tune maintenance schedule in RFC3339 format. Time should be in the future.
395+
- cron_schedule - A cron expression specifying the recurrence pattern for an Auto-Tune maintenance schedule.
396+
- duration - Autotune maintanance window duration time in hours.
397+
EOT
398+
399+
validation {
400+
condition = var.auto_tune.enabled == false || var.auto_tune.cron_schedule != null
401+
error_message = "Variable auto_tune.cron_schedule should be set if var.auto_tune.enabled == true."
402+
}
403+
404+
validation {
405+
condition = var.auto_tune.enabled == false || var.auto_tune.duration != null
406+
error_message = "Variable auto_tune.duration should be set if var.auto_tune.enabled == true."
407+
}
408+
409+
validation {
410+
condition = contains(["DEFAULT_ROLLBACK", "NO_ROLLBACK"], var.auto_tune.rollback_on_disable)
411+
error_message = "Variable auto_tune.rollback_on_disable valid values: DEFAULT_ROLLBACK or NO_ROLLBACK."
412+
}
413+
}
414+

0 commit comments

Comments
 (0)