providers/aws: Convert Launch Configurations to awslabs/aws-sdk-go

This commit is contained in:
Clint Shryock 2015-02-20 16:26:43 -06:00
parent 39e8f15752
commit 92bf85925b
5 changed files with 119 additions and 80 deletions

View File

@ -7,14 +7,13 @@ import (
"unicode" "unicode"
"github.com/hashicorp/terraform/helper/multierror" "github.com/hashicorp/terraform/helper/multierror"
"github.com/mitchellh/goamz/autoscaling"
"github.com/mitchellh/goamz/aws" "github.com/mitchellh/goamz/aws"
"github.com/mitchellh/goamz/ec2" "github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/goamz/elb" "github.com/mitchellh/goamz/elb"
"github.com/mitchellh/goamz/rds" "github.com/mitchellh/goamz/rds"
awsGo "github.com/awslabs/aws-sdk-go/aws" awsGo "github.com/awslabs/aws-sdk-go/aws"
awsAutoScaling "github.com/awslabs/aws-sdk-go/gen/autoscaling" "github.com/awslabs/aws-sdk-go/gen/autoscaling"
"github.com/awslabs/aws-sdk-go/gen/route53" "github.com/awslabs/aws-sdk-go/gen/route53"
"github.com/awslabs/aws-sdk-go/gen/s3" "github.com/awslabs/aws-sdk-go/gen/s3"
) )
@ -26,14 +25,13 @@ type Config struct {
} }
type AWSClient struct { type AWSClient struct {
ec2conn *ec2.EC2 ec2conn *ec2.EC2
elbconn *elb.ELB elbconn *elb.ELB
autoscalingconn *autoscaling.AutoScaling autoscalingconn *autoscaling.AutoScaling
s3conn *s3.S3 s3conn *s3.S3
rdsconn *rds.Rds rdsconn *rds.Rds
r53conn *route53.Route53 r53conn *route53.Route53
region string region string
awsAutoScalingconn *awsAutoScaling.AutoScaling
} }
// Client configures and returns a fully initailized AWSClient // Client configures and returns a fully initailized AWSClient
@ -67,7 +65,7 @@ func (c *Config) Client() (interface{}, error) {
log.Println("[INFO] Initializing ELB connection") log.Println("[INFO] Initializing ELB connection")
client.elbconn = elb.New(auth, region) client.elbconn = elb.New(auth, region)
log.Println("[INFO] Initializing AutoScaling connection") log.Println("[INFO] Initializing AutoScaling connection")
client.autoscalingconn = autoscaling.New(auth, region) client.autoscalingconn = autoscaling.New(creds, c.Region, nil)
log.Println("[INFO] Initializing S3 connection") log.Println("[INFO] Initializing S3 connection")
client.s3conn = s3.New(creds, c.Region, nil) client.s3conn = s3.New(creds, c.Region, nil)
log.Println("[INFO] Initializing RDS connection") log.Println("[INFO] Initializing RDS connection")
@ -78,8 +76,6 @@ func (c *Config) Client() (interface{}, error) {
// See http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html // See http://docs.aws.amazon.com/general/latest/gr/sigv4_changes.html
log.Println("[INFO] Initializing Route53 connection") log.Println("[INFO] Initializing Route53 connection")
client.r53conn = route53.New(creds, "us-east-1", nil) client.r53conn = route53.New(creds, "us-east-1", nil)
log.Println("[INFO] Initializing AWS Go AutoScaling connection")
client.awsAutoScalingconn = awsAutoScaling.New(creds, c.Region, nil)
} }
if len(errs) > 0 { if len(errs) > 0 {

View File

@ -123,7 +123,7 @@ func resourceAwsAutoscalingGroup() *schema.Resource {
} }
func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).awsAutoScalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
var autoScalingGroupOpts autoscaling.CreateAutoScalingGroupType var autoScalingGroupOpts autoscaling.CreateAutoScalingGroupType
autoScalingGroupOpts.AutoScalingGroupName = aws.String(d.Get("name").(string)) autoScalingGroupOpts.AutoScalingGroupName = aws.String(d.Get("name").(string))
@ -199,7 +199,7 @@ 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).awsAutoScalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
opts := autoscaling.UpdateAutoScalingGroupType{ opts := autoscaling.UpdateAutoScalingGroupType{
AutoScalingGroupName: aws.String(d.Id()), AutoScalingGroupName: aws.String(d.Id()),
@ -232,7 +232,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).awsAutoScalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
// 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.
@ -276,7 +276,7 @@ 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).awsAutoScalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
describeOpts := autoscaling.AutoScalingGroupNamesType{ describeOpts := autoscaling.AutoScalingGroupNamesType{
AutoScalingGroupNames: []string{d.Id()}, AutoScalingGroupNames: []string{d.Id()},
@ -307,7 +307,7 @@ func getAwsAutoscalingGroup(
} }
func resourceAwsAutoscalingGroupDrain(d *schema.ResourceData, meta interface{}) error { func resourceAwsAutoscalingGroupDrain(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).awsAutoScalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
// 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")

View File

@ -4,9 +4,10 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/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"
"github.com/mitchellh/goamz/autoscaling"
) )
func TestAccAWSAutoScalingGroup_basic(t *testing.T) { func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
@ -51,8 +52,7 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) {
testAccCheckAWSLaunchConfigurationExists("aws_launch_configuration.new", &lc), testAccCheckAWSLaunchConfigurationExists("aws_launch_configuration.new", &lc),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_autoscaling_group.bar", "desired_capacity", "5"), "aws_autoscaling_group.bar", "desired_capacity", "5"),
resource.TestCheckResourceAttrPtr( testLaunchConfigurationName("aws_autoscaling_group.bar", &lc),
"aws_autoscaling_group.bar", "launch_configuration", &lc.Name),
), ),
}, },
}, },
@ -87,19 +87,19 @@ 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.DescribeAutoScalingGroups{ &autoscaling.AutoScalingGroupNamesType{
Names: []string{rs.Primary.ID}, AutoScalingGroupNames: []string{rs.Primary.ID},
}) })
if err == nil { if err == nil {
if len(describeGroups.AutoScalingGroups) != 0 && if len(describeGroups.AutoScalingGroups) != 0 &&
describeGroups.AutoScalingGroups[0].Name == rs.Primary.ID { *describeGroups.AutoScalingGroups[0].AutoScalingGroupName == rs.Primary.ID {
return fmt.Errorf("AutoScaling Group still exists") return fmt.Errorf("AutoScaling Group still exists")
} }
} }
// Verify the error // Verify the error
ec2err, ok := err.(*autoscaling.Error) ec2err, ok := err.(aws.APIError)
if !ok { if !ok {
return err return err
} }
@ -117,32 +117,32 @@ func testAccCheckAWSAutoScalingGroupAttributes(group *autoscaling.AutoScalingGro
return fmt.Errorf("Bad availability_zones: %s", group.AvailabilityZones[0]) return fmt.Errorf("Bad availability_zones: %s", group.AvailabilityZones[0])
} }
if group.Name != "foobar3-terraform-test" { if *group.AutoScalingGroupName != "foobar3-terraform-test" {
return fmt.Errorf("Bad name: %s", group.Name) return fmt.Errorf("Bad name: %s", *group.AutoScalingGroupName)
} }
if group.MaxSize != 5 { if *group.MaxSize != 5 {
return fmt.Errorf("Bad max_size: %d", group.MaxSize) return fmt.Errorf("Bad max_size: %d", *group.MaxSize)
} }
if group.MinSize != 2 { if *group.MinSize != 2 {
return fmt.Errorf("Bad max_size: %d", group.MinSize) return fmt.Errorf("Bad max_size: %d", *group.MinSize)
} }
if group.HealthCheckType != "ELB" { if *group.HealthCheckType != "ELB" {
return fmt.Errorf("Bad health_check_type: %s", group.HealthCheckType) return fmt.Errorf("Bad health_check_type: %s", *group.HealthCheckType)
} }
if group.HealthCheckGracePeriod != 300 { if *group.HealthCheckGracePeriod != 300 {
return fmt.Errorf("Bad health_check_grace_period: %d", group.HealthCheckGracePeriod) return fmt.Errorf("Bad health_check_grace_period: %d", *group.HealthCheckGracePeriod)
} }
if group.DesiredCapacity != 4 { if *group.DesiredCapacity != 4 {
return fmt.Errorf("Bad desired_capacity: %d", group.DesiredCapacity) return fmt.Errorf("Bad desired_capacity: %d", *group.DesiredCapacity)
} }
if group.LaunchConfigurationName == "" { if *group.LaunchConfigurationName == "" {
return fmt.Errorf("Bad launch configuration name: %s", group.LaunchConfigurationName) return fmt.Errorf("Bad launch configuration name: %s", *group.LaunchConfigurationName)
} }
return nil return nil
@ -172,8 +172,8 @@ func testAccCheckAWSAutoScalingGroupExists(n string, group *autoscaling.AutoScal
conn := testAccProvider.Meta().(*AWSClient).autoscalingconn conn := testAccProvider.Meta().(*AWSClient).autoscalingconn
describeOpts := autoscaling.DescribeAutoScalingGroups{ describeOpts := autoscaling.AutoScalingGroupNamesType{
Names: []string{rs.Primary.ID}, AutoScalingGroupNames: []string{rs.Primary.ID},
} }
describeGroups, err := conn.DescribeAutoScalingGroups(&describeOpts) describeGroups, err := conn.DescribeAutoScalingGroups(&describeOpts)
@ -182,7 +182,7 @@ func testAccCheckAWSAutoScalingGroupExists(n string, group *autoscaling.AutoScal
} }
if len(describeGroups.AutoScalingGroups) != 1 || if len(describeGroups.AutoScalingGroups) != 1 ||
describeGroups.AutoScalingGroups[0].Name != rs.Primary.ID { *describeGroups.AutoScalingGroups[0].AutoScalingGroupName != rs.Primary.ID {
return fmt.Errorf("AutoScaling Group not found") return fmt.Errorf("AutoScaling Group not found")
} }
@ -192,6 +192,21 @@ func testAccCheckAWSAutoScalingGroupExists(n string, group *autoscaling.AutoScal
} }
} }
func testLaunchConfigurationName(n string, lc *autoscaling.LaunchConfiguration) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if *lc.LaunchConfigurationName != rs.Primary.Attributes["launch_configuration"] {
return fmt.Errorf("Launch configuration names do not match")
}
return nil
}
}
const testAccAWSAutoScalingGroupConfig = ` const testAccAWSAutoScalingGroupConfig = `
resource "aws_launch_configuration" "foobar" { resource "aws_launch_configuration" "foobar" {
name = "foobarautoscaling-terraform-test" name = "foobarautoscaling-terraform-test"

View File

@ -2,15 +2,17 @@ package aws
import ( import (
"crypto/sha1" "crypto/sha1"
"encoding/base64"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"log" "log"
"time" "time"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/gen/autoscaling"
"github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/hashcode"
"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/mitchellh/goamz/autoscaling"
) )
func resourceAwsLaunchConfiguration() *schema.Resource { func resourceAwsLaunchConfiguration() *schema.Resource {
@ -94,15 +96,26 @@ func resourceAwsLaunchConfiguration() *schema.Resource {
func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).autoscalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
var createLaunchConfigurationOpts autoscaling.CreateLaunchConfiguration var createLaunchConfigurationOpts autoscaling.CreateLaunchConfigurationType
createLaunchConfigurationOpts.Name = d.Get("name").(string) createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(d.Get("name").(string))
createLaunchConfigurationOpts.IamInstanceProfile = d.Get("iam_instance_profile").(string) createLaunchConfigurationOpts.ImageID = aws.String(d.Get("image_id").(string))
createLaunchConfigurationOpts.ImageId = d.Get("image_id").(string) createLaunchConfigurationOpts.InstanceType = aws.String(d.Get("instance_type").(string))
createLaunchConfigurationOpts.InstanceType = d.Get("instance_type").(string)
createLaunchConfigurationOpts.KeyName = d.Get("key_name").(string) if v, ok := d.GetOk("user_data"); ok {
createLaunchConfigurationOpts.UserData = d.Get("user_data").(string) createLaunchConfigurationOpts.UserData = aws.String(base64.StdEncoding.EncodeToString([]byte(v.(string))))
createLaunchConfigurationOpts.AssociatePublicIpAddress = d.Get("associate_public_ip_address").(bool) }
createLaunchConfigurationOpts.SpotPrice = d.Get("spot_price").(string) if v, ok := d.GetOk("associate_public_ip_address"); ok {
createLaunchConfigurationOpts.AssociatePublicIPAddress = aws.Boolean(v.(bool))
}
if v, ok := d.GetOk("iam_instance_profile"); ok {
createLaunchConfigurationOpts.IAMInstanceProfile = aws.String(v.(string))
}
if v, ok := d.GetOk("key_name"); ok {
createLaunchConfigurationOpts.KeyName = aws.String(v.(string))
}
if v, ok := d.GetOk("spot_price"); ok {
createLaunchConfigurationOpts.SpotPrice = aws.String(v.(string))
}
if v, ok := d.GetOk("security_groups"); ok { if v, ok := d.GetOk("security_groups"); ok {
createLaunchConfigurationOpts.SecurityGroups = expandStringList( createLaunchConfigurationOpts.SecurityGroups = expandStringList(
@ -110,7 +123,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
} }
log.Printf("[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts) log.Printf("[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts)
_, err := autoscalingconn.CreateLaunchConfiguration(&createLaunchConfigurationOpts) err := autoscalingconn.CreateLaunchConfiguration(&createLaunchConfigurationOpts)
if err != nil { if err != nil {
return fmt.Errorf("Error creating launch configuration: %s", err) return fmt.Errorf("Error creating launch configuration: %s", err)
} }
@ -128,8 +141,8 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}) error {
autoscalingconn := meta.(*AWSClient).autoscalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
describeOpts := autoscaling.DescribeLaunchConfigurations{ describeOpts := autoscaling.LaunchConfigurationNamesType{
Names: []string{d.Id()}, LaunchConfigurationNames: []string{d.Id()},
} }
log.Printf("[DEBUG] launch configuration describe configuration: %#v", describeOpts) log.Printf("[DEBUG] launch configuration describe configuration: %#v", describeOpts)
@ -143,7 +156,7 @@ func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}
} }
// Verify AWS returned our launch configuration // Verify AWS returned our launch configuration
if describConfs.LaunchConfigurations[0].Name != d.Id() { if *describConfs.LaunchConfigurations[0].LaunchConfigurationName != d.Id() {
return fmt.Errorf( return fmt.Errorf(
"Unable to find launch configuration: %#v", "Unable to find launch configuration: %#v",
describConfs.LaunchConfigurations) describConfs.LaunchConfigurations)
@ -151,14 +164,28 @@ func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}
lc := describConfs.LaunchConfigurations[0] lc := describConfs.LaunchConfigurations[0]
d.Set("key_name", lc.KeyName) d.Set("key_name", *lc.KeyName)
d.Set("iam_instance_profile", lc.IamInstanceProfile) d.Set("image_id", *lc.ImageID)
d.Set("image_id", lc.ImageId) d.Set("instance_type", *lc.InstanceType)
d.Set("instance_type", lc.InstanceType) d.Set("name", *lc.LaunchConfigurationName)
d.Set("name", lc.Name)
d.Set("security_groups", lc.SecurityGroups)
d.Set("spot_price", lc.SpotPrice)
if lc.IAMInstanceProfile != nil {
d.Set("iam_instance_profile", *lc.IAMInstanceProfile)
} else {
d.Set("iam_instance_profile", nil)
}
if lc.SpotPrice != nil {
d.Set("spot_price", *lc.SpotPrice)
} else {
d.Set("spot_price", nil)
}
if lc.SecurityGroups != nil {
d.Set("security_groups", lc.SecurityGroups)
} else {
d.Set("security_groups", nil)
}
return nil return nil
} }
@ -166,10 +193,10 @@ func resourceAwsLaunchConfigurationDelete(d *schema.ResourceData, meta interface
autoscalingconn := meta.(*AWSClient).autoscalingconn autoscalingconn := meta.(*AWSClient).autoscalingconn
log.Printf("[DEBUG] Launch Configuration destroy: %v", d.Id()) log.Printf("[DEBUG] Launch Configuration destroy: %v", d.Id())
_, err := autoscalingconn.DeleteLaunchConfiguration( err := autoscalingconn.DeleteLaunchConfiguration(
&autoscaling.DeleteLaunchConfiguration{Name: d.Id()}) &autoscaling.LaunchConfigurationNameType{LaunchConfigurationName: aws.String(d.Id())})
if err != nil { if err != nil {
autoscalingerr, ok := err.(*autoscaling.Error) autoscalingerr, ok := err.(aws.APIError)
if ok && autoscalingerr.Code == "InvalidConfiguration.NotFound" { if ok && autoscalingerr.Code == "InvalidConfiguration.NotFound" {
return nil return nil
} }

View File

@ -4,9 +4,10 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/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"
"github.com/mitchellh/goamz/autoscaling"
) )
func TestAccAWSLaunchConfiguration(t *testing.T) { func TestAccAWSLaunchConfiguration(t *testing.T) {
@ -57,19 +58,19 @@ func testAccCheckAWSLaunchConfigurationDestroy(s *terraform.State) error {
} }
describe, err := conn.DescribeLaunchConfigurations( describe, err := conn.DescribeLaunchConfigurations(
&autoscaling.DescribeLaunchConfigurations{ &autoscaling.LaunchConfigurationNamesType{
Names: []string{rs.Primary.ID}, LaunchConfigurationNames: []string{rs.Primary.ID},
}) })
if err == nil { if err == nil {
if len(describe.LaunchConfigurations) != 0 && if len(describe.LaunchConfigurations) != 0 &&
describe.LaunchConfigurations[0].Name == rs.Primary.ID { *describe.LaunchConfigurations[0].LaunchConfigurationName == rs.Primary.ID {
return fmt.Errorf("Launch Configuration still exists") return fmt.Errorf("Launch Configuration still exists")
} }
} }
// Verify the error // Verify the error
providerErr, ok := err.(*autoscaling.Error) providerErr, ok := err.(aws.APIError)
if !ok { if !ok {
return err return err
} }
@ -83,16 +84,16 @@ func testAccCheckAWSLaunchConfigurationDestroy(s *terraform.State) error {
func testAccCheckAWSLaunchConfigurationAttributes(conf *autoscaling.LaunchConfiguration) resource.TestCheckFunc { func testAccCheckAWSLaunchConfigurationAttributes(conf *autoscaling.LaunchConfiguration) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
if conf.ImageId != "ami-21f78e11" { if *conf.ImageID != "ami-21f78e11" {
return fmt.Errorf("Bad image_id: %s", conf.ImageId) return fmt.Errorf("Bad image_id: %s", *conf.ImageID)
} }
if conf.Name != "foobar-terraform-test" { if *conf.LaunchConfigurationName != "foobar-terraform-test" {
return fmt.Errorf("Bad name: %s", conf.Name) return fmt.Errorf("Bad name: %s", *conf.LaunchConfigurationName)
} }
if conf.InstanceType != "t1.micro" { if *conf.InstanceType != "t1.micro" {
return fmt.Errorf("Bad instance_type: %s", conf.InstanceType) return fmt.Errorf("Bad instance_type: %s", *conf.InstanceType)
} }
return nil return nil
@ -112,8 +113,8 @@ func testAccCheckAWSLaunchConfigurationExists(n string, res *autoscaling.LaunchC
conn := testAccProvider.Meta().(*AWSClient).autoscalingconn conn := testAccProvider.Meta().(*AWSClient).autoscalingconn
describeOpts := autoscaling.DescribeLaunchConfigurations{ describeOpts := autoscaling.LaunchConfigurationNamesType{
Names: []string{rs.Primary.ID}, LaunchConfigurationNames: []string{rs.Primary.ID},
} }
describe, err := conn.DescribeLaunchConfigurations(&describeOpts) describe, err := conn.DescribeLaunchConfigurations(&describeOpts)
@ -122,7 +123,7 @@ func testAccCheckAWSLaunchConfigurationExists(n string, res *autoscaling.LaunchC
} }
if len(describe.LaunchConfigurations) != 1 || if len(describe.LaunchConfigurations) != 1 ||
describe.LaunchConfigurations[0].Name != rs.Primary.ID { *describe.LaunchConfigurations[0].LaunchConfigurationName != rs.Primary.ID {
return fmt.Errorf("Launch Configuration Group not found") return fmt.Errorf("Launch Configuration Group not found")
} }