Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Instance refresh #229

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions modules/consul-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ resource "aws_autoscaling_group" "autoscaling_group" {
role_arn = lookup(initial_lifecycle_hook.value, "role_arn", null)
}
}

dynamic "instance_refresh" {
for_each = range(var.instance_refresh == null ? 0 : 1)
content {
strategy = var.instance_refresh.strategy
dynamic "preferences" {
for_each = range(lookup(var.instance_refresh, "preferences", null) == null ? 0 : 1)
content {
instance_warmup = lookup(var.instance_refresh.preferences, "instance_warmup", null)
min_healthy_percentage = lookup(var.instance_refresh.preferences, "min_healthy_percentage", null)
}
}
triggers = lookup(var.instance_refresh, "triggers", null)
}
}

lifecycle {
# As of AWS Provider 3.x, inline load_balancers and target_group_arns
Expand Down
22 changes: 22 additions & 0 deletions modules/consul-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,28 @@ variable "lifecycle_hooks" {
}
}

variable "instance_refresh" {
description = "Setting for an instance refresh triggered after the group is updated. The value is an object that is defined in the instance_refresh block of the aws_autoscaling_group resource. The default is not to trigger an instance refresh"
type = any
default = null

# example = {
# strategy = string : ROLLING
# preferences = {
# instance_warmup = int
# min_healthy_percentage = int
# }
# triggers = list(string)
# }

}

variable "enable_unsafe_instance_refresh" {
description = "If set to true, enables an instance_refresh to proceed with unsafe min_healthy_percentage value."
type = bool
default = false
}

variable "associate_public_ip_address" {
description = "If set to true, associate a public IP address with each EC2 Instance in the cluster."
type = bool
Expand Down