Skip to content

Commit 6f62338

Browse files
author
Luca Venturelli
authored
adding option to specify wait_for_capacity_timeout (#24)
1 parent f970467 commit 6f62338

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ Terraform module to setup blue / green deployments
3434
| target\_group\_arns | A list of aws_alb_target_group ARNs, for use with Application Load Balancing | list | `<list>` | no |
3535
| termination\_policies | (Optional, Default: ['Default']) Order in termination policies to apply when choosing instances to terminate. | list | `<list>` | no |
3636
| user\_data | (Optional) The user data to provide when launching the instance | string | `"# Hello World"` | no |
37+
| wait\_for\_capacity\_timeout | A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. Setting this to 0 causes Terraform to skip all Capacity Waiting behavior. | string | `"10m"` | no |
3738

3839
### Outputs
3940

4041
| Name | Description |
4142
|------|-------------|
42-
| blue\_asg\_id | |
43-
| green\_asg\_id | |
43+
| blue\_asg\_id | Blue autoscaling group id |
44+
| green\_asg\_id | Green autoscaling group id |
4445

4546
### Example
4647

blue-green/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module "blue" {
2424
target_group_arns = "${var.target_group_arns}"
2525
health_check_type = "${var.health_check_type}"
2626
tags = "${var.tags}"
27+
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"
2728
}
2829

2930
module "green" {
@@ -52,4 +53,5 @@ module "green" {
5253
target_group_arns = "${var.target_group_arns}"
5354
health_check_type = "${var.health_check_type}"
5455
tags = "${var.tags}"
56+
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"
5557
}

blue-green/outputs.tf

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
output "blue_asg_id" {
2+
description = "Blue autoscaling group id"
23
value = "${module.blue.asg_id}"
34
}
45

56
output "green_asg_id" {
7+
description = "Green autoscaling group id"
68
value = "${module.green.asg_id}"
79
}

blue-green/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,8 @@ variable "spot_price" {
126126
description = "Spot price you want to pay for your instances. By default this is empty and we will use on-demand instances"
127127
default = ""
128128
}
129+
130+
variable "wait_for_capacity_timeout" {
131+
description = " A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. Setting this to 0 causes Terraform to skip all Capacity Waiting behavior."
132+
default = "10m"
133+
}

single-stack/main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ resource "aws_autoscaling_group" "bluegreen_asg" {
3131
health_check_grace_period = "${var.health_check_grace_period}"
3232
termination_policies = ["${var.termination_policies}"]
3333
target_group_arns = ["${var.target_group_arns}"]
34-
34+
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"
35+
3536
tags = ["${concat(
3637
list(
3738
map("key", "Environment", "value", "${var.environment}", "propagate_at_launch", true),

single-stack/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ variable "spot_price" {
114114
description = "Spot price you want to pay for your instances. By default this is empty and we will use on-demand instances"
115115
default = ""
116116
}
117+
118+
variable "wait_for_capacity_timeout" {
119+
description = "A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. Setting this to 0 causes Terraform to skip all Capacity Waiting behavior."
120+
default = "10m"
121+
}

0 commit comments

Comments
 (0)