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

resource/aws_autoscaling_group: Ignore ordering differences for tags argument #13515

Merged
merged 1 commit into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aws/autoscaling_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ func setAutoscalingTags(conn *autoscaling.AutoScaling, d *schema.ResourceData) e
removeTags = append(removeTags, r...)

oraw, nraw = d.GetChange("tags")
old, err = autoscalingTagsFromList(oraw.([]interface{}), resourceID)
old, err = autoscalingTagsFromList(oraw.(*schema.Set).List(), resourceID)
if err != nil {
return err
}

new, err = autoscalingTagsFromList(nraw.([]interface{}), resourceID)
new, err = autoscalingTagsFromList(nraw.(*schema.Set).List(), resourceID)
if err != nil {
return err
}
Expand Down Expand Up @@ -165,7 +165,7 @@ func autoscalingTagsFromList(vs []interface{}, resourceID string) ([]*autoscalin
result := make([]*autoscaling.Tag, 0, len(vs))
for _, tag := range vs {
attr, ok := tag.(map[string]interface{})
if !ok {
if !ok || len(attr) == 0 {
continue
}

Expand Down
6 changes: 3 additions & 3 deletions aws/resource_aws_autoscaling_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
"tag": autoscalingTagSchema(),

"tags": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeMap,
Expand Down Expand Up @@ -548,7 +548,7 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{})
}

if v, ok := d.GetOk("tags"); ok {
tags, err := autoscalingTagsFromList(v.([]interface{}), resourceID)
tags, err := autoscalingTagsFromList(v.(*schema.Set).List(), resourceID)
if err != nil {
return err
}
Expand Down Expand Up @@ -734,7 +734,7 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e

if v, tagsOk = d.GetOk("tags"); tagsOk {
tags := map[string]struct{}{}
for _, tag := range v.([]interface{}) {
for _, tag := range v.(*schema.Set).List() {
attr, ok := tag.(map[string]interface{})
if !ok {
continue
Expand Down
8 changes: 4 additions & 4 deletions aws/resource_aws_autoscaling_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2276,13 +2276,13 @@ resource "aws_autoscaling_group" "bar" {
propagate_at_launch = true
},
{
key = "FromTags2"
value = "value2"
key = "FromTags3"
value = "value3"
propagate_at_launch = true
},
{
key = "FromTags3"
value = "value3"
key = "FromTags2"
value = "value2"
propagate_at_launch = true
},
]
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/autoscaling_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ The following arguments are supported:
* `termination_policies` (Optional) A list of policies to decide how the instances in the auto scale group should be terminated. The allowed values are `OldestInstance`, `NewestInstance`, `OldestLaunchConfiguration`, `ClosestToNextInstanceHour`, `OldestLaunchTemplate`, `AllocationStrategy`, `Default`.
* `suspended_processes` - (Optional) A list of processes to suspend for the AutoScaling Group. The allowed values are `Launch`, `Terminate`, `HealthCheck`, `ReplaceUnhealthy`, `AZRebalance`, `AlarmNotification`, `ScheduledActions`, `AddToLoadBalancer`.
Note that if you suspend either the `Launch` or `Terminate` process types, it can prevent your autoscaling group from functioning properly.
* `tag` (Optional) A list of tag blocks. Tags documented below.
* `tags` (Optional) A list of tag blocks (maps). Tags documented below.
* `tag` (Optional) Configuration block(s) containing resource tags. Conflicts with `tags`. Documented below.
* `tags` (Optional) Set of maps containing resource tags. Conflicts with `tag`. Documented below.
* `placement_group` (Optional) The name of the placement group into which you'll launch your instances, if any.
* `metrics_granularity` - (Optional) The granularity to associate with the metrics to collect. The only valid value is `1Minute`. Default is `1Minute`.
* `enabled_metrics` - (Optional) A list of metrics to collect. The allowed values are `GroupDesiredCapacity`, `GroupInServiceCapacity`, `GroupPendingCapacity`, `GroupMinSize`, `GroupMaxSize`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupStandbyCapacity`, `GroupTerminatingCapacity`, `GroupTerminatingInstances`, `GroupTotalCapacity`, `GroupTotalInstances`.
Expand Down