Skip to content

Commit

Permalink
adding option to specify wait_for_capacity_timeout (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Venturelli authored Apr 9, 2019
1 parent f970467 commit 6f62338
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ Terraform module to setup blue / green deployments
| target\_group\_arns | A list of aws_alb_target_group ARNs, for use with Application Load Balancing | list | `<list>` | no |
| termination\_policies | (Optional, Default: ['Default']) Order in termination policies to apply when choosing instances to terminate. | list | `<list>` | no |
| user\_data | (Optional) The user data to provide when launching the instance | string | `"# Hello World"` | no |
| 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 |

### Outputs

| Name | Description |
|------|-------------|
| blue\_asg\_id | |
| green\_asg\_id | |
| blue\_asg\_id | Blue autoscaling group id |
| green\_asg\_id | Green autoscaling group id |

### Example

Expand Down
2 changes: 2 additions & 0 deletions blue-green/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module "blue" {
target_group_arns = "${var.target_group_arns}"
health_check_type = "${var.health_check_type}"
tags = "${var.tags}"
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"
}

module "green" {
Expand Down Expand Up @@ -52,4 +53,5 @@ module "green" {
target_group_arns = "${var.target_group_arns}"
health_check_type = "${var.health_check_type}"
tags = "${var.tags}"
wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"
}
2 changes: 2 additions & 0 deletions blue-green/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
output "blue_asg_id" {
description = "Blue autoscaling group id"
value = "${module.blue.asg_id}"
}

output "green_asg_id" {
description = "Green autoscaling group id"
value = "${module.green.asg_id}"
}
5 changes: 5 additions & 0 deletions blue-green/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,8 @@ variable "spot_price" {
description = "Spot price you want to pay for your instances. By default this is empty and we will use on-demand instances"
default = ""
}

variable "wait_for_capacity_timeout" {
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."
default = "10m"
}
3 changes: 2 additions & 1 deletion single-stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ resource "aws_autoscaling_group" "bluegreen_asg" {
health_check_grace_period = "${var.health_check_grace_period}"
termination_policies = ["${var.termination_policies}"]
target_group_arns = ["${var.target_group_arns}"]

wait_for_capacity_timeout = "${var.wait_for_capacity_timeout}"

tags = ["${concat(
list(
map("key", "Environment", "value", "${var.environment}", "propagate_at_launch", true),
Expand Down
5 changes: 5 additions & 0 deletions single-stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,8 @@ variable "spot_price" {
description = "Spot price you want to pay for your instances. By default this is empty and we will use on-demand instances"
default = ""
}

variable "wait_for_capacity_timeout" {
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."
default = "10m"
}

0 comments on commit 6f62338

Please sign in to comment.