Skip to content

Commit 47d3e21

Browse files
authored
availability zone distribution (#282)
1 parent ea61a31 commit 47d3e21

File tree

6 files changed

+27
-6
lines changed

6 files changed

+27
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ Note: the default behavior of the module is to create an autoscaling group and l
231231
| Name | Version |
232232
|------|---------|
233233
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
234-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |
234+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82.1 |
235235

236236
## Providers
237237

238238
| Name | Version |
239239
|------|---------|
240-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.55 |
240+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82.1 |
241241

242242
## Modules
243243

@@ -264,6 +264,7 @@ No modules.
264264
| Name | Description | Type | Default | Required |
265265
|------|-------------|------|---------|:--------:|
266266
| <a name="input_autoscaling_group_tags"></a> [autoscaling\_group\_tags](#input\_autoscaling\_group\_tags) | A map of additional tags to add to the autoscaling group | `map(string)` | `{}` | no |
267+
| <a name="input_availability_zone_distribution"></a> [availability\_zone\_distribution](#input\_availability\_zone\_distribution) | A map of configuration for capacity distribution across availability zones | `any` | `{}` | no |
267268
| <a name="input_availability_zones"></a> [availability\_zones](#input\_availability\_zones) | A list of one or more availability zones for the group. Used for EC2-Classic and default subnets when not specified with `vpc_zone_identifier` argument. Conflicts with `vpc_zone_identifier` | `list(string)` | `null` | no |
268269
| <a name="input_block_device_mappings"></a> [block\_device\_mappings](#input\_block\_device\_mappings) | Specify volumes to attach to the instance besides the volumes specified by the AMI | `list(any)` | `[]` | no |
269270
| <a name="input_capacity_rebalance"></a> [capacity\_rebalance](#input\_capacity\_rebalance) | Indicates whether capacity rebalance is enabled | `bool` | `null` | no |

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Note that this example may create resources which cost money. Run `terraform des
3030
| Name | Version |
3131
|------|---------|
3232
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
33-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |
33+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82.1 |
3434

3535
## Providers
3636

3737
| Name | Version |
3838
|------|---------|
39-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.55 |
39+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.82.1 |
4040

4141
## Modules
4242

examples/complete/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.55"
7+
version = ">= 5.82.1"
88
}
99
}
1010
}

main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,13 @@ resource "aws_autoscaling_group" "this" {
391391
service_linked_role_arn = var.service_linked_role_arn
392392
ignore_failed_scaling_activities = var.ignore_failed_scaling_activities
393393

394+
dynamic "availability_zone_distribution" {
395+
for_each = length(var.availability_zone_distribution) > 0 ? [var.availability_zone_distribution] : []
396+
content {
397+
capacity_distribution_strategy = availability_zone_distribution.value.capacity_distribution_strategy
398+
}
399+
}
400+
394401
dynamic "initial_lifecycle_hook" {
395402
for_each = var.initial_lifecycle_hooks
396403
content {
@@ -682,6 +689,13 @@ resource "aws_autoscaling_group" "idc" {
682689
service_linked_role_arn = var.service_linked_role_arn
683690
ignore_failed_scaling_activities = var.ignore_failed_scaling_activities
684691

692+
dynamic "availability_zone_distribution" {
693+
for_each = length(var.availability_zone_distribution) > 0 ? [var.availability_zone_distribution] : []
694+
content {
695+
capacity_distribution_strategy = availability_zone_distribution.value.capacity_distribution_strategy
696+
}
697+
}
698+
685699
dynamic "initial_lifecycle_hook" {
686700
for_each = var.initial_lifecycle_hooks
687701
content {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ variable "availability_zones" {
4949
default = null
5050
}
5151

52+
variable "availability_zone_distribution" {
53+
description = "A map of configuration for capacity distribution across availability zones"
54+
type = any
55+
default = {}
56+
}
57+
5258
variable "vpc_zone_identifier" {
5359
description = "A list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts with `availability_zones`"
5460
type = list(string)

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.55"
7+
version = ">= 5.82.1"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)