go fmt asg things

This commit is contained in:
Clint Shryock 2015-04-15 15:30:35 -05:00
parent 1f7d0944f1
commit 723be13f96
4 changed files with 68 additions and 68 deletions

View File

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/autoscaling" "github.com/awslabs/aws-sdk-go/service/autoscaling"
"github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
) )
@ -61,23 +61,23 @@ func setAutoscalingTags(conn *autoscaling.AutoScaling, d *schema.ResourceData) e
autoscalingTagsFromMap(o, resourceID), autoscalingTagsFromMap(o, resourceID),
autoscalingTagsFromMap(n, resourceID), autoscalingTagsFromMap(n, resourceID),
resourceID) resourceID)
create := autoscaling.CreateOrUpdateTagsInput{ create := autoscaling.CreateOrUpdateTagsInput{
Tags: c, Tags: c,
} }
remove := autoscaling.DeleteTagsInput{ remove := autoscaling.DeleteTagsInput{
Tags: r, Tags: r,
} }
// Set tags // Set tags
if len(r) > 0 { if len(r) > 0 {
log.Printf("[DEBUG] Removing autoscaling tags: %#v", r) log.Printf("[DEBUG] Removing autoscaling tags: %#v", r)
if _, err := conn.DeleteTags(&remove); err != nil { if _, err := conn.DeleteTags(&remove); err != nil {
return err return err
} }
} }
if len(c) > 0 { if len(c) > 0 {
log.Printf("[DEBUG] Creating autoscaling tags: %#v", c) log.Printf("[DEBUG] Creating autoscaling tags: %#v", c)
if _, err := conn.CreateOrUpdateTags(&create); err != nil { if _, err := conn.CreateOrUpdateTags(&create); err != nil {
return err return err
} }
} }
@ -101,7 +101,7 @@ func diffAutoscalingTags(oldTags, newTags []*autoscaling.Tag, resourceID string)
} }
// Build the list of what to remove // Build the list of what to remove
var remove []*autoscaling.Tag var remove []*autoscaling.Tag
for _, t := range oldTags { for _, t := range oldTags {
old, ok := create[*t.Key].(map[string]interface{}) old, ok := create[*t.Key].(map[string]interface{})
@ -116,10 +116,10 @@ func diffAutoscalingTags(oldTags, newTags []*autoscaling.Tag, resourceID string)
// tagsFromMap returns the tags for the given map of data. // tagsFromMap returns the tags for the given map of data.
func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) []*autoscaling.Tag { func autoscalingTagsFromMap(m map[string]interface{}, resourceID string) []*autoscaling.Tag {
result := make([]*autoscaling.Tag, 0, len(m)) result := make([]*autoscaling.Tag, 0, len(m))
for k, v := range m { for k, v := range m {
attr := v.(map[string]interface{}) attr := v.(map[string]interface{})
result = append(result, &autoscaling.Tag{ result = append(result, &autoscaling.Tag{
Key: aws.String(k), Key: aws.String(k),
Value: aws.String(attr["value"].(string)), Value: aws.String(attr["value"].(string)),
PropagateAtLaunch: aws.Boolean(attr["propagate_at_launch"].(bool)), PropagateAtLaunch: aws.Boolean(attr["propagate_at_launch"].(bool)),
@ -148,7 +148,7 @@ func autoscalingTagsToMap(ts []*autoscaling.Tag) map[string]interface{} {
// autoscalingTagDescriptionsToMap turns the list of tags into a map. // autoscalingTagDescriptionsToMap turns the list of tags into a map.
func autoscalingTagDescriptionsToMap(ts *[]*autoscaling.TagDescription) map[string]map[string]interface{} { func autoscalingTagDescriptionsToMap(ts *[]*autoscaling.TagDescription) map[string]map[string]interface{} {
tags := make(map[string]map[string]interface{}) tags := make(map[string]map[string]interface{})
for _, t := range *ts { for _, t := range *ts {
tag := map[string]interface{}{ tag := map[string]interface{}{
"value": *t.Value, "value": *t.Value,
"propagate_at_launch": *t.PropagateAtLaunch, "propagate_at_launch": *t.PropagateAtLaunch,

View File

@ -5,7 +5,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/awslabs/aws-sdk-go/service/autoscaling" "github.com/awslabs/aws-sdk-go/service/autoscaling"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
@ -93,9 +93,9 @@ func TestDiffAutoscalingTags(t *testing.T) {
// testAccCheckTags can be used to check the tags on a resource. // testAccCheckTags can be used to check the tags on a resource.
func testAccCheckAutoscalingTags( func testAccCheckAutoscalingTags(
ts *[]*autoscaling.TagDescription, key string, expected map[string]interface{}) resource.TestCheckFunc { ts *[]*autoscaling.TagDescription, key string, expected map[string]interface{}) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
m := autoscalingTagDescriptionsToMap(ts) m := autoscalingTagDescriptionsToMap(ts)
v, ok := m[key] v, ok := m[key]
if !ok { if !ok {
return fmt.Errorf("Missing tag: %s", key) return fmt.Errorf("Missing tag: %s", key)
@ -112,7 +112,7 @@ func testAccCheckAutoscalingTags(
func testAccCheckAutoscalingTagNotExists(ts *[]*autoscaling.TagDescription, key string) resource.TestCheckFunc { func testAccCheckAutoscalingTagNotExists(ts *[]*autoscaling.TagDescription, key string) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
m := autoscalingTagDescriptionsToMap(ts) m := autoscalingTagDescriptionsToMap(ts)
if _, ok := m[key]; ok { if _, ok := m[key]; ok {
return fmt.Errorf("Tag exists when it should not: %s", key) return fmt.Errorf("Tag exists when it should not: %s", key)
} }

View File

@ -10,8 +10,8 @@ import (
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/autoscaling" "github.com/awslabs/aws-sdk-go/service/autoscaling"
) )
func resourceAwsAutoscalingGroup() *schema.Resource { func resourceAwsAutoscalingGroup() *schema.Resource {
@ -125,14 +125,14 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
} }
func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).asgconn autoscalingconn := meta.(*AWSClient).asgconn
var autoScalingGroupOpts autoscaling.CreateAutoScalingGroupInput var autoScalingGroupOpts autoscaling.CreateAutoScalingGroupInput
autoScalingGroupOpts.AutoScalingGroupName = aws.String(d.Get("name").(string)) autoScalingGroupOpts.AutoScalingGroupName = aws.String(d.Get("name").(string))
autoScalingGroupOpts.LaunchConfigurationName = aws.String(d.Get("launch_configuration").(string)) autoScalingGroupOpts.LaunchConfigurationName = aws.String(d.Get("launch_configuration").(string))
autoScalingGroupOpts.MinSize = aws.Long(int64(d.Get("min_size").(int))) autoScalingGroupOpts.MinSize = aws.Long(int64(d.Get("min_size").(int)))
autoScalingGroupOpts.MaxSize = aws.Long(int64(d.Get("max_size").(int))) autoScalingGroupOpts.MaxSize = aws.Long(int64(d.Get("max_size").(int)))
autoScalingGroupOpts.AvailabilityZones = expandStringListSDK( autoScalingGroupOpts.AvailabilityZones = expandStringListSDK(
d.Get("availability_zones").(*schema.Set).List()) d.Get("availability_zones").(*schema.Set).List())
if v, ok := d.GetOk("tag"); ok { if v, ok := d.GetOk("tag"); ok {
@ -141,7 +141,7 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{})
} }
if v, ok := d.GetOk("default_cooldown"); ok { if v, ok := d.GetOk("default_cooldown"); ok {
autoScalingGroupOpts.DefaultCooldown = aws.Long(int64(v.(int))) autoScalingGroupOpts.DefaultCooldown = aws.Long(int64(v.(int)))
} }
if v, ok := d.GetOk("health_check_type"); ok && v.(string) != "" { if v, ok := d.GetOk("health_check_type"); ok && v.(string) != "" {
@ -149,34 +149,34 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{})
} }
if v, ok := d.GetOk("desired_capacity"); ok { if v, ok := d.GetOk("desired_capacity"); ok {
autoScalingGroupOpts.DesiredCapacity = aws.Long(int64(v.(int))) autoScalingGroupOpts.DesiredCapacity = aws.Long(int64(v.(int)))
} }
if v, ok := d.GetOk("health_check_grace_period"); ok { if v, ok := d.GetOk("health_check_grace_period"); ok {
autoScalingGroupOpts.HealthCheckGracePeriod = aws.Long(int64(v.(int))) autoScalingGroupOpts.HealthCheckGracePeriod = aws.Long(int64(v.(int)))
} }
if v, ok := d.GetOk("load_balancers"); ok && v.(*schema.Set).Len() > 0 { if v, ok := d.GetOk("load_balancers"); ok && v.(*schema.Set).Len() > 0 {
autoScalingGroupOpts.LoadBalancerNames = expandStringListSDK( autoScalingGroupOpts.LoadBalancerNames = expandStringListSDK(
v.(*schema.Set).List()) v.(*schema.Set).List())
} }
if v, ok := d.GetOk("vpc_zone_identifier"); ok && v.(*schema.Set).Len() > 0 { if v, ok := d.GetOk("vpc_zone_identifier"); ok && v.(*schema.Set).Len() > 0 {
exp := expandStringListSDK(v.(*schema.Set).List()) exp := expandStringListSDK(v.(*schema.Set).List())
strs := make([]string, len(exp)) strs := make([]string, len(exp))
for _, s := range exp { for _, s := range exp {
strs = append(strs, *s) strs = append(strs, *s)
} }
autoScalingGroupOpts.VPCZoneIdentifier = aws.String(strings.Join(strs, ",")) autoScalingGroupOpts.VPCZoneIdentifier = aws.String(strings.Join(strs, ","))
} }
if v, ok := d.GetOk("termination_policies"); ok && v.(*schema.Set).Len() > 0 { if v, ok := d.GetOk("termination_policies"); ok && v.(*schema.Set).Len() > 0 {
autoScalingGroupOpts.TerminationPolicies = expandStringListSDK( autoScalingGroupOpts.TerminationPolicies = expandStringListSDK(
v.(*schema.Set).List()) v.(*schema.Set).List())
} }
log.Printf("[DEBUG] AutoScaling Group create configuration: %#v", autoScalingGroupOpts) log.Printf("[DEBUG] AutoScaling Group create configuration: %#v", autoScalingGroupOpts)
_, err := autoscalingconn.CreateAutoScalingGroup(&autoScalingGroupOpts) _, err := autoscalingconn.CreateAutoScalingGroup(&autoScalingGroupOpts)
if err != nil { if err != nil {
return fmt.Errorf("Error creating Autoscaling Group: %s", err) return fmt.Errorf("Error creating Autoscaling Group: %s", err)
} }
@ -214,14 +214,14 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e
} }
func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).asgconn autoscalingconn := meta.(*AWSClient).asgconn
opts := autoscaling.UpdateAutoScalingGroupInput{ opts := autoscaling.UpdateAutoScalingGroupInput{
AutoScalingGroupName: aws.String(d.Id()), AutoScalingGroupName: aws.String(d.Id()),
} }
if d.HasChange("desired_capacity") { if d.HasChange("desired_capacity") {
opts.DesiredCapacity = aws.Long(int64(d.Get("desired_capacity").(int))) opts.DesiredCapacity = aws.Long(int64(d.Get("desired_capacity").(int)))
} }
if d.HasChange("launch_configuration") { if d.HasChange("launch_configuration") {
@ -229,11 +229,11 @@ func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{})
} }
if d.HasChange("min_size") { if d.HasChange("min_size") {
opts.MinSize = aws.Long(int64(d.Get("min_size").(int))) opts.MinSize = aws.Long(int64(d.Get("min_size").(int)))
} }
if d.HasChange("max_size") { if d.HasChange("max_size") {
opts.MaxSize = aws.Long(int64(d.Get("max_size").(int))) opts.MaxSize = aws.Long(int64(d.Get("max_size").(int)))
} }
if err := setAutoscalingTags(autoscalingconn, d); err != nil { if err := setAutoscalingTags(autoscalingconn, d); err != nil {
@ -243,7 +243,7 @@ func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{})
} }
log.Printf("[DEBUG] AutoScaling Group update configuration: %#v", opts) log.Printf("[DEBUG] AutoScaling Group update configuration: %#v", opts)
_, err := autoscalingconn.UpdateAutoScalingGroup(&opts) _, err := autoscalingconn.UpdateAutoScalingGroup(&opts)
if err != nil { if err != nil {
d.Partial(true) d.Partial(true)
return fmt.Errorf("Error updating Autoscaling group: %s", err) return fmt.Errorf("Error updating Autoscaling group: %s", err)
@ -253,7 +253,7 @@ func resourceAwsAutoscalingGroupUpdate(d *schema.ResourceData, meta interface{})
} }
func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).asgconn autoscalingconn := meta.(*AWSClient).asgconn
// Read the autoscaling group first. If it doesn't exist, we're done. // Read the autoscaling group first. If it doesn't exist, we're done.
// We need the group in order to check if there are instances attached. // We need the group in order to check if there are instances attached.
@ -272,7 +272,7 @@ func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{})
} }
log.Printf("[DEBUG] AutoScaling Group destroy: %v", d.Id()) log.Printf("[DEBUG] AutoScaling Group destroy: %v", d.Id())
deleteopts := autoscaling.DeleteAutoScalingGroupInput{AutoScalingGroupName: aws.String(d.Id())} deleteopts := autoscaling.DeleteAutoScalingGroupInput{AutoScalingGroupName: aws.String(d.Id())}
// You can force an autoscaling group to delete // You can force an autoscaling group to delete
// even if it's in the process of scaling a resource. // even if it's in the process of scaling a resource.
@ -283,7 +283,7 @@ func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{})
deleteopts.ForceDelete = aws.Boolean(true) deleteopts.ForceDelete = aws.Boolean(true)
} }
if _, err := autoscalingconn.DeleteAutoScalingGroup(&deleteopts); err != nil { if _, err := autoscalingconn.DeleteAutoScalingGroup(&deleteopts); err != nil {
autoscalingerr, ok := err.(aws.APIError) autoscalingerr, ok := err.(aws.APIError)
if ok && autoscalingerr.Code == "InvalidGroup.NotFound" { if ok && autoscalingerr.Code == "InvalidGroup.NotFound" {
return nil return nil
@ -302,10 +302,10 @@ func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{})
func getAwsAutoscalingGroup( func getAwsAutoscalingGroup(
d *schema.ResourceData, d *schema.ResourceData,
meta interface{}) (*autoscaling.AutoScalingGroup, error) { meta interface{}) (*autoscaling.AutoScalingGroup, error) {
autoscalingconn := meta.(*AWSClient).asgconn autoscalingconn := meta.(*AWSClient).asgconn
describeOpts := autoscaling.DescribeAutoScalingGroupsInput{ describeOpts := autoscaling.DescribeAutoScalingGroupsInput{
AutoScalingGroupNames: []*string{aws.String(d.Id())}, AutoScalingGroupNames: []*string{aws.String(d.Id())},
} }
log.Printf("[DEBUG] AutoScaling Group describe configuration: %#v", describeOpts) log.Printf("[DEBUG] AutoScaling Group describe configuration: %#v", describeOpts)
@ -323,7 +323,7 @@ func getAwsAutoscalingGroup(
// Search for the autoscaling group // Search for the autoscaling group
for idx, asc := range describeGroups.AutoScalingGroups { for idx, asc := range describeGroups.AutoScalingGroups {
if *asc.AutoScalingGroupName == d.Id() { if *asc.AutoScalingGroupName == d.Id() {
return describeGroups.AutoScalingGroups[idx], nil return describeGroups.AutoScalingGroups[idx], nil
} }
} }
@ -333,17 +333,17 @@ func getAwsAutoscalingGroup(
} }
func resourceAwsAutoscalingGroupDrain(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupDrain(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).asgconn autoscalingconn := meta.(*AWSClient).asgconn
// First, set the capacity to zero so the group will drain // First, set the capacity to zero so the group will drain
log.Printf("[DEBUG] Reducing autoscaling group capacity to zero") log.Printf("[DEBUG] Reducing autoscaling group capacity to zero")
opts := autoscaling.UpdateAutoScalingGroupInput{ opts := autoscaling.UpdateAutoScalingGroupInput{
AutoScalingGroupName: aws.String(d.Id()), AutoScalingGroupName: aws.String(d.Id()),
DesiredCapacity: aws.Long(0), DesiredCapacity: aws.Long(0),
MinSize: aws.Long(0), MinSize: aws.Long(0),
MaxSize: aws.Long(0), MaxSize: aws.Long(0),
} }
if _, err := autoscalingconn.UpdateAutoScalingGroup(&opts); err != nil { if _, err := autoscalingconn.UpdateAutoScalingGroup(&opts); err != nil {
return fmt.Errorf("Error setting capacity to zero to drain: %s", err) return fmt.Errorf("Error setting capacity to zero to drain: %s", err)
} }

View File

@ -5,16 +5,16 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/awslabs/aws-sdk-go/aws" "github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/service/autoscaling" "github.com/awslabs/aws-sdk-go/service/autoscaling"
hashiASG "github.com/hashicorp/aws-sdk-go/gen/autoscaling" hashiASG "github.com/hashicorp/aws-sdk-go/gen/autoscaling"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
func TestAccAWSAutoScalingGroup_basic(t *testing.T) { func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
var group autoscaling.AutoScalingGroup var group autoscaling.AutoScalingGroup
var lc hashiASG.LaunchConfiguration var lc hashiASG.LaunchConfiguration
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
@ -118,7 +118,7 @@ func TestAccAWSAutoScalingGroup_WithLoadBalancer(t *testing.T) {
}) })
} }
func testAccCheckAWSAutoScalingGroupDestroy(s *terraform.State) error { func testAccCheckAWSAutoScalingGroupDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).asgconn conn := testAccProvider.Meta().(*AWSClient).asgconn
for _, rs := range s.RootModule().Resources { for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_autoscaling_group" { if rs.Type != "aws_autoscaling_group" {
@ -127,8 +127,8 @@ func testAccCheckAWSAutoScalingGroupDestroy(s *terraform.State) error {
// Try to find the Group // Try to find the Group
describeGroups, err := conn.DescribeAutoScalingGroups( describeGroups, err := conn.DescribeAutoScalingGroups(
&autoscaling.DescribeAutoScalingGroupsInput{ &autoscaling.DescribeAutoScalingGroupsInput{
AutoScalingGroupNames: []*string{aws.String(rs.Primary.ID)}, AutoScalingGroupNames: []*string{aws.String(rs.Primary.ID)},
}) })
if err == nil { if err == nil {
@ -153,7 +153,7 @@ func testAccCheckAWSAutoScalingGroupDestroy(s *terraform.State) error {
func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGroup) resource.TestCheckFunc { func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGroup) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
if *group.AvailabilityZones[0] != "us-west-2a" { if *group.AvailabilityZones[0] != "us-west-2a" {
return fmt.Errorf("Bad availability_zones: %s", group.AvailabilityZones[0]) return fmt.Errorf("Bad availability_zones: %s", group.AvailabilityZones[0])
} }
@ -185,7 +185,7 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
return fmt.Errorf("Bad launch configuration name: %s", *group.LaunchConfigurationName) return fmt.Errorf("Bad launch configuration name: %s", *group.LaunchConfigurationName)
} }
t := &autoscaling.TagDescription{ t := &autoscaling.TagDescription{
Key: aws.String("Foo"), Key: aws.String("Foo"),
Value: aws.String("foo-bar"), Value: aws.String("foo-bar"),
PropagateAtLaunch: aws.Boolean(true), PropagateAtLaunch: aws.Boolean(true),
@ -206,7 +206,7 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
func testAccCheckAWSAutoScalingGroupAttributesLoadBalancer(group *autoscaling.AutoScalingGroup) resource.TestCheckFunc { func testAccCheckAWSAutoScalingGroupAttributesLoadBalancer(group *autoscaling.AutoScalingGroup) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
if *group.LoadBalancerNames[0] != "foobar-terraform-test" { if *group.LoadBalancerNames[0] != "foobar-terraform-test" {
return fmt.Errorf("Bad load_balancers: %s", group.LoadBalancerNames[0]) return fmt.Errorf("Bad load_balancers: %s", group.LoadBalancerNames[0])
} }
@ -225,12 +225,12 @@ func testAccCheckAWSAutoScalingGroupExists(n string, group *autoscaling.AutoScal
return fmt.Errorf("No AutoScaling Group ID is set") return fmt.Errorf("No AutoScaling Group ID is set")
} }
conn := testAccProvider.Meta().(*AWSClient).asgconn conn := testAccProvider.Meta().(*AWSClient).asgconn
describeGroups, err := conn.DescribeAutoScalingGroups( describeGroups, err := conn.DescribeAutoScalingGroups(
&autoscaling.DescribeAutoScalingGroupsInput{ &autoscaling.DescribeAutoScalingGroupsInput{
AutoScalingGroupNames: []*string{aws.String(rs.Primary.ID)}, AutoScalingGroupNames: []*string{aws.String(rs.Primary.ID)},
}) })
if err != nil { if err != nil {
return err return err
@ -241,7 +241,7 @@ func testAccCheckAWSAutoScalingGroupExists(n string, group *autoscaling.AutoScal
return fmt.Errorf("AutoScaling Group not found") return fmt.Errorf("AutoScaling Group not found")
} }
*group = *describeGroups.AutoScalingGroups[0] *group = *describeGroups.AutoScalingGroups[0]
return nil return nil
} }