Skip to content

Commit

Permalink
feat: Adds max_healthy_percentage and skip_matching to autoscalin…
Browse files Browse the repository at this point in the history
…g group (#256)

* Bump provider constraint to >= 5.32.0 since that's when max_health_percentage attribute support was added and allow configuring max_healthy_percentage

* Add support for skip_matching

* Update docs

* Adds max_healthy_percentage and skip_matching to examples; also updates examples to look for Amazon Linux 2 AMIs since Amazon Linux AMIs are already end of life.

* Update AWS provider version requirement in examples
  • Loading branch information
easterbonbon authored Feb 21, 2024
1 parent 62b879b commit faf98ef
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module "asg" {
checkpoint_percentages = [35, 70, 100]
instance_warmup = 300
min_healthy_percentage = 50
max_healthy_percentage = 100
}
triggers = ["tag"]
}
Expand Down Expand Up @@ -230,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.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.32 |

## Providers

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

## Modules

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.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.32 |

## Providers

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

## Modules

Expand Down
6 changes: 5 additions & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ module "complete" {
checkpoint_percentages = [35, 70, 100]
instance_warmup = 300
min_healthy_percentage = 50
max_healthy_percentage = 100
auto_rollback = true
scale_in_protected_instances = "Refresh"
standby_instances = "Terminate"
skip_matching = false
}
triggers = ["tag"]
}
Expand Down Expand Up @@ -348,6 +350,8 @@ module "mixed_instance" {
checkpoint_percentages = [35, 70, 100]
instance_warmup = 300
min_healthy_percentage = 50
max_healthy_percentage = 100
skip_matching = true
}
triggers = ["tag"]
}
Expand Down Expand Up @@ -848,7 +852,7 @@ data "aws_ami" "amazon_linux" {
name = "name"

values = [
"amzn-ami-hvm-*-x86_64-gp2",
"amzn2-ami-hvm-*-x86_64-gp2",
]
}
}
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.26"
version = ">= 5.32"
}
}
}
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,10 @@ resource "aws_autoscaling_group" "this" {
checkpoint_percentages = try(preferences.value.checkpoint_percentages, null)
instance_warmup = try(preferences.value.instance_warmup, null)
min_healthy_percentage = try(preferences.value.min_healthy_percentage, null)
max_healthy_percentage = try(preferences.value.max_healthy_percentage, null)
auto_rollback = try(preferences.value.auto_rollback, null)
scale_in_protected_instances = try(preferences.value.scale_in_protected_instances, null)
skip_matching = try(preferences.value.skip_matching, null)
standby_instances = try(preferences.value.standby_instances, null)
}
}
Expand Down Expand Up @@ -703,8 +705,10 @@ resource "aws_autoscaling_group" "idc" {
checkpoint_percentages = try(preferences.value.checkpoint_percentages, null)
instance_warmup = try(preferences.value.instance_warmup, null)
min_healthy_percentage = try(preferences.value.min_healthy_percentage, null)
max_healthy_percentage = try(preferences.value.max_healthy_percentage, null)
auto_rollback = try(preferences.value.auto_rollback, null)
scale_in_protected_instances = try(preferences.value.scale_in_protected_instances, null)
skip_matching = try(preferences.value.skip_matching, null)
standby_instances = try(preferences.value.standby_instances, null)
}
}
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.26"
version = ">= 5.32"
}
}
}

0 comments on commit faf98ef

Please sign in to comment.