Skip to content

Commit

Permalink
Merge commit '16fc36ac7c2d8bbc2bfcbc70433ad04968335e9d' into HEAD
Browse files Browse the repository at this point in the history
# Conflicts:
#	internal/service/autoscaling/group.go
#	internal/service/autoscaling/group_test.go
#	website/docs/r/autoscaling_group.html.markdown
  • Loading branch information
ewbankkit committed Apr 18, 2024
2 parents 8655a11 + 16fc36a commit 91021cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
24 changes: 14 additions & 10 deletions internal/service/autoscaling/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,22 +232,26 @@ func resourceGroup() *schema.Resource {
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"auto_rollback": {
Type: schema.TypeBool,
Optional: true,
},
"alarm_specification": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"alarms": {
Type: schema.TypeList,
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
"auto_rollback": {
Type: schema.TypeBool,
Optional: true,
},
"checkpoint_delay": {
Type: nullable.TypeNullableInt,
Optional: true,
Expand Down Expand Up @@ -3314,12 +3318,12 @@ func expandRefreshPreferences(tfMap map[string]interface{}) *awstypes.RefreshPre

apiObject := &awstypes.RefreshPreferences{}

if v, ok := tfMap["auto_rollback"].(bool); ok {
apiObject.AutoRollback = aws.Bool(v)
if v, ok := tfMap["alarm_specification"].([]interface{}); ok && len(v) > 0 {
apiObject.AlarmSpecification = expandAlarmSpecification(v[0].(map[string]interface{}))
}

if v, ok := tfMap["alarm_specification"].([]interface{}); ok && len(v) > 0 {
apiObject.AlarmSpecification = expandRefreshAlarmSpecification(v[0].(map[string]interface{}))
if v, ok := tfMap["auto_rollback"].(bool); ok {
apiObject.AutoRollback = aws.Bool(v)
}

if v, ok := tfMap["checkpoint_delay"].(string); ok {
Expand Down Expand Up @@ -3361,7 +3365,7 @@ func expandRefreshPreferences(tfMap map[string]interface{}) *awstypes.RefreshPre
return apiObject
}

func expandRefreshAlarmSpecification(tfMap map[string]interface{}) *awstypes.AlarmSpecification {
func expandAlarmSpecification(tfMap map[string]interface{}) *awstypes.AlarmSpecification {
if tfMap == nil {
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion internal/service/autoscaling/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5355,8 +5355,9 @@ resource "aws_autoscaling_group" "test" {
preferences {
min_healthy_percentage = 0
alarm_specification {
alarms = ["my-alarm-1", "my-alarm-2"]
alarms = ["my-alarm-1", "my-alarm-2"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/autoscaling_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ This configuration block supports the following:
- `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`.
- `alarm_specification` - (Optional) Alarm Specification for Instance Refresh.
- `alarms` - (Required) List of Cloudwatch alarms. If any of these alarms goes into ALARM state, Instance Refresh is failed.
- `alarms` - (Required) List of Cloudwatch alarms. If any of these alarms goes into ALARM state, Instance Refresh is failed.
- `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`.
- `standby_instances` - (Optional) Behavior when encountering instances in the `Standby` state in are found. Available behaviors are `Terminate`, `Ignore`, and `Wait`. Default is `Ignore`.
- `triggers` - (Optional) Set of additional property names that will trigger an Instance Refresh. A refresh will always be triggered by a change in any of `launch_configuration`, `launch_template`, or `mixed_instances_policy`.
Expand Down

0 comments on commit 91021cb

Please sign in to comment.