Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added max_healthy_percentage field to instance_refresh on aws_autoscaling_group #34792

Merged
3 changes: 3 additions & 0 deletions .changelog/34792.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_autoscaling_group: Add instance_refresh > preferences > max_healthy_percentage argument
```
10 changes: 10 additions & 0 deletions internal/service/autoscaling/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ func ResourceGroup() *schema.Resource {
Default: 90,
ValidateFunc: validation.IntBetween(0, 100),
},
"max_healthy_percentage": {
Type: schema.TypeInt,
Optional: true,
Default: 100,
ValidateFunc: validation.IntBetween(100, 200),
},
"scale_in_protected_instances": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -3378,6 +3384,10 @@ func expandRefreshPreferences(tfMap map[string]interface{}) *autoscaling.Refresh
apiObject.MinHealthyPercentage = aws.Int64(int64(v))
}

if v, ok := tfMap["max_healthy_percentage"].(int); ok {
apiObject.MaxHealthyPercentage = aws.Int64(int64(v))
}

if v, ok := tfMap["scale_in_protected_instances"].(string); ok {
apiObject.ScaleInProtectedInstances = aws.String(v)
}
Expand Down
5 changes: 5 additions & 0 deletions internal/service/autoscaling/group_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ func resourceGroupV0() *schema.Resource {
Optional: true,
Default: 90,
},
"max_healthy_percentage": {
Type: schema.TypeInt,
Optional: true,
Default: 100,
},
"skip_matching": {
Type: schema.TypeBool,
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ This configuration block supports the following:
- `checkpoint_percentages` - (Optional) List of percentages for each checkpoint. Values must be unique and in ascending order. To replace all instances, the final number must be `100`.
- `instance_warmup` - (Optional) Number of seconds until a newly launched instance is configured and ready to use. Default behavior is to use the Auto Scaling Group's health check grace period.
- `min_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`.
- `max_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that can be healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `100`.
- `skip_matching` - (Optional) Replace instances that already have your desired configuration. Defaults to `false`.
- `auto_rollback` - (Optional) Automatically rollback if instance refresh fails. Defaults to `false`. This option may only be set to `true` when specifying a `launch_template` or `mixed_instances_policy`.
- `scale_in_protected_instances` - (Optional) Behavior when encountering instances protected from scale in are found. Available behaviors are `Refresh`, `Ignore`, and `Wait`. Default is `Ignore`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ This configuration block supports the following:
- `checkpoint_percentages` - (Optional) List of percentages for each checkpoint. Values must be unique and in ascending order. To replace all instances, the final number must be `100`.
- `instance_warmup` - (Optional) Number of seconds until a newly launched instance is configured and ready to use. Default behavior is to use the Auto Scaling Group's health check grace period.
- `min_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`.
- `max_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that can be healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`.
- `skip_matching` - (Optional) Replace instances that already have your desired configuration. Defaults to `false`.
- `auto_rollback` - (Optional) Automatically rollback if instance refresh fails. Defaults to `false`. This option may only be set to `true` when specifying a `launch_template` or `mixed_instances_policy`.
- `scale_in_protected_instances` - (Optional) Behavior when encountering instances protected from scale in are found. Available behaviors are `Refresh`, `Ignore`, and `Wait`. Default is `Ignore`.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/autoscaling_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ This configuration block supports the following:
- `checkpoint_percentages` - (Optional) List of percentages for each checkpoint. Values must be unique and in ascending order. To replace all instances, the final number must be `100`.
- `instance_warmup` - (Optional) Number of seconds until a newly launched instance is configured and ready to use. Default behavior is to use the Auto Scaling Group's health check grace period.
- `min_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `90`.
- `max_healthy_percentage` - (Optional) Amount of capacity in the Auto Scaling group that can be healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group. Defaults to `100`.
- `skip_matching` - (Optional) Replace instances that already have your desired configuration. Defaults to `false`.
- `auto_rollback` - (Optional) Automatically rollback if instance refresh fails. Defaults to `false`. This option may only be set to `true` when specifying a `launch_template` or `mixed_instances_policy`.
- `scale_in_protected_instances` - (Optional) Behavior when encountering instances protected from scale in are found. Available behaviors are `Refresh`, `Ignore`, and `Wait`. Default is `Ignore`.
Expand Down
Loading