(MODE-11365) Set localexec to ASG to reduce service downtime.
This commit is contained in:
parent
bf1be831d0
commit
f7f5a8a6b7
1 changed files with 5 additions and 0 deletions
|
|
@ -44,6 +44,11 @@ resource "aws_autoscaling_group" "autoscalinggroup" {
|
||||||
value = "maps"
|
value = "maps"
|
||||||
propagate_at_launch = true
|
propagate_at_launch = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
# Wait until the number of "ok" instance status checks is equal to 1
|
||||||
|
command = "sleep 15; i=0; while [[ $(/usr/bin/aws ec2 describe-instances --filters 'Name=tag:aws:autoscaling:groupName,Values=${aws_autoscaling_group.autoscalinggroup.name}' --query 'Reservations[*].Instances[*].InstanceId' --output text | xargs aws ec2 describe-instance-status --query 'InstanceStatuses[*].SystemStatus.Status' --instance-ids | jq 'map(select(. == \"ok\")) | length') -lt 1 ]]; do i=$(echo $((++i))); echo ''; echo retrying $i; sleep 5;if [[ $i -eq 60 ]]; then exit 1; fi; done; sleep 45"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue