From 120cfdce59b8903b43b1baf538ba7dd8d988c5f9 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Mon, 27 Apr 2015 19:55:26 -0500 Subject: [PATCH] provider/aws: fix EIPs on new upstream sdk As we've seen elsewhere, the SDK now wants nils instead of empty arrays for collections fixes #1696 thanks @jstremick for pointing me in the right direction --- builtin/providers/aws/resource_aws_eip.go | 4 ++-- builtin/providers/aws/resource_aws_eip_test.go | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/builtin/providers/aws/resource_aws_eip.go b/builtin/providers/aws/resource_aws_eip.go index dae35f21a..f871e764d 100644 --- a/builtin/providers/aws/resource_aws_eip.go +++ b/builtin/providers/aws/resource_aws_eip.go @@ -102,8 +102,8 @@ func resourceAwsEipRead(d *schema.ResourceData, meta interface{}) error { domain := resourceAwsEipDomain(d) id := d.Id() - assocIds := []*string{} - publicIps := []*string{} + var assocIds []*string + var publicIps []*string if domain == "vpc" { assocIds = []*string{aws.String(id)} } else { diff --git a/builtin/providers/aws/resource_aws_eip_test.go b/builtin/providers/aws/resource_aws_eip_test.go index 48a54935e..199dc3046 100644 --- a/builtin/providers/aws/resource_aws_eip_test.go +++ b/builtin/providers/aws/resource_aws_eip_test.go @@ -66,8 +66,7 @@ func testAccCheckAWSEIPDestroy(s *terraform.State) error { } req := &ec2.DescribeAddressesInput{ - AllocationIDs: []*string{}, - PublicIPs: []*string{aws.String(rs.Primary.ID)}, + PublicIPs: []*string{aws.String(rs.Primary.ID)}, } describe, err := conn.DescribeAddresses(req) @@ -118,7 +117,6 @@ func testAccCheckAWSEIPExists(n string, res *ec2.Address) resource.TestCheckFunc if strings.Contains(rs.Primary.ID, "eipalloc") { req := &ec2.DescribeAddressesInput{ AllocationIDs: []*string{aws.String(rs.Primary.ID)}, - PublicIPs: []*string{}, } describe, err := conn.DescribeAddresses(req) if err != nil { @@ -133,8 +131,7 @@ func testAccCheckAWSEIPExists(n string, res *ec2.Address) resource.TestCheckFunc } else { req := &ec2.DescribeAddressesInput{ - AllocationIDs: []*string{}, - PublicIPs: []*string{aws.String(rs.Primary.ID)}, + PublicIPs: []*string{aws.String(rs.Primary.ID)}, } describe, err := conn.DescribeAddresses(req) if err != nil {