Skip to content

Commit

Permalink
Make auto_tune options dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Verhaar committed Mar 22, 2024
1 parent 0fc1007 commit d4857bc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
36 changes: 26 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,33 @@ resource "aws_elasticsearch_domain" "opensearch" {
role_arn = var.cognito_enabled ? var.cognito_role_arn : ""
}

auto_tune_options {
desired_state = var.autotune_enabled ? var.autotune_options.desired_state : "DISABLED"
rollback_on_disable = var.autotune_enabled ? var.autotune_options.rollback_on_disable : null

maintenance_schedule {
start_at = var.autotune_options.maintenance_schedule.start_at
duration {
value = var.autotune_options.maintenance_schedule.duration
unit = "HOURS"
# auto_tune_options {
# desired_state = var.autotune_enabled ? var.autotune_options.desired_state : "DISABLED"
# rollback_on_disable = var.autotune_enabled ? var.autotune_options.rollback_on_disable : null
#
# maintenance_schedule {
# start_at = var.autotune_options.maintenance_schedule.start_at
# duration {
# value = var.autotune_options.maintenance_schedule.duration
# unit = "HOURS"
# }
# cron_expression_for_recurrence = var.autotune_options.maintenance_schedule.cron_expression
# }
# }
dynamic "auto_tune_options" {
for_each = var.autotune_enabled ? [1] : []
content {
desired_state = var.autotune_options.desired_state
rollback_on_disable = var.autotune_options.rollback_on_disable

maintenance_schedule {
start_at = var.autotune_options.maintenance_schedule.start_at
duration {
value = var.autotune_options.maintenance_schedule.duration
unit = "HOURS"
}
cron_expression_for_recurrence = var.autotune_options.maintenance_schedule.cron_expression
}
cron_expression_for_recurrence = var.autotune_options.maintenance_schedule.cron_expression
}
}

Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ variable "autotune_options" {
desired_state = "ENABLED"
rollback_on_disable = "NO_ROLLBACK"
maintenance_schedule = {
cron_expression = "value"
cron_expression = "cron(0 0 ? * 1 *)"
duration = 1
start_at = "2000-01-01T00:00:00.00Z"
}
Expand Down

0 comments on commit d4857bc

Please sign in to comment.