Skip to content

Commit

Permalink
availability zone distribution (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
magreenbaum authored Dec 20, 2024
1 parent ea61a31 commit 47d3e21
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ Note: the default behavior of the module is to create an autoscaling group and l
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82.1 |

## Providers

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

## Modules

Expand All @@ -264,6 +264,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <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 |
| <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 |
| <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 |
| <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 |
| <a name="input_capacity_rebalance"></a> [capacity\_rebalance](#input\_capacity\_rebalance) | Indicates whether capacity rebalance is enabled | `bool` | `null` | no |
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.82.1 |

## Providers

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

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.55"
version = ">= 5.82.1"
}
}
}
14 changes: 14 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ resource "aws_autoscaling_group" "this" {
service_linked_role_arn = var.service_linked_role_arn
ignore_failed_scaling_activities = var.ignore_failed_scaling_activities

dynamic "availability_zone_distribution" {
for_each = length(var.availability_zone_distribution) > 0 ? [var.availability_zone_distribution] : []
content {
capacity_distribution_strategy = availability_zone_distribution.value.capacity_distribution_strategy
}
}

dynamic "initial_lifecycle_hook" {
for_each = var.initial_lifecycle_hooks
content {
Expand Down Expand Up @@ -682,6 +689,13 @@ resource "aws_autoscaling_group" "idc" {
service_linked_role_arn = var.service_linked_role_arn
ignore_failed_scaling_activities = var.ignore_failed_scaling_activities

dynamic "availability_zone_distribution" {
for_each = length(var.availability_zone_distribution) > 0 ? [var.availability_zone_distribution] : []
content {
capacity_distribution_strategy = availability_zone_distribution.value.capacity_distribution_strategy
}
}

dynamic "initial_lifecycle_hook" {
for_each = var.initial_lifecycle_hooks
content {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ variable "availability_zones" {
default = null
}

variable "availability_zone_distribution" {
description = "A map of configuration for capacity distribution across availability zones"
type = any
default = {}
}

variable "vpc_zone_identifier" {
description = "A list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts with `availability_zones`"
type = list(string)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.55"
version = ">= 5.82.1"
}
}
}

0 comments on commit 47d3e21

Please sign in to comment.