Skip to content

Commit

Permalink
Added max_healthy_percentage field to instance_refresh on aws_autos…
Browse files Browse the repository at this point in the history
…caling_group
  • Loading branch information
nwmqpa committed Dec 7, 2023
1 parent 7ae058f commit 7454106
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
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

0 comments on commit 7454106

Please sign in to comment.