ran go fmt and made 1 fix after running tests again

This commit is contained in:
Peter Beams 2015-03-17 13:00:36 +00:00
parent 34d2efa7df
commit e4214a9983
4 changed files with 85 additions and 85 deletions

View File

@ -1,17 +1,17 @@
package aws package aws
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"log" "log"
"strconv" "strconv"
"time" "time"
"github.com/hashicorp/aws-sdk-go/aws" "github.com/hashicorp/aws-sdk-go/aws"
"github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/aws-sdk-go/gen/ec2"
"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/hashicorp/aws-sdk-go/gen/ec2"
) )
func resourceAwsNetworkInterface() *schema.Resource { func resourceAwsNetworkInterface() *schema.Resource {
@ -21,18 +21,18 @@ func resourceAwsNetworkInterface() *schema.Resource {
Update: resourceAwsNetworkInterfaceUpdate, Update: resourceAwsNetworkInterfaceUpdate,
Delete: resourceAwsNetworkInterfaceDelete, Delete: resourceAwsNetworkInterfaceDelete,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"subnet_id": &schema.Schema{ "subnet_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true, ForceNew: true,
}, },
"private_ips": &schema.Schema{ "private_ips": &schema.Schema{
Type: schema.TypeSet, Type: schema.TypeSet,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString}, Elem: &schema.Schema{Type: schema.TypeString},
Set: func(v interface{}) int { Set: func(v interface{}) int {
return hashcode.String(v.(string)) return hashcode.String(v.(string))
@ -42,7 +42,7 @@ func resourceAwsNetworkInterface() *schema.Resource {
"security_groups": &schema.Schema{ "security_groups": &schema.Schema{
Type: schema.TypeSet, Type: schema.TypeSet,
Optional: true, Optional: true,
Computed: true, Computed: true,
Elem: &schema.Schema{Type: schema.TypeString}, Elem: &schema.Schema{Type: schema.TypeString},
Set: func(v interface{}) int { Set: func(v interface{}) int {
return hashcode.String(v.(string)) return hashcode.String(v.(string))
@ -63,29 +63,29 @@ func resourceAwsNetworkInterface() *schema.Resource {
Required: true, Required: true,
}, },
"attachment_id": &schema.Schema{ "attachment_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
}, },
}, },
Set: resourceAwsEniAttachmentHash, Set: resourceAwsEniAttachmentHash,
}, },
"tags": tagsSchema(), "tags": tagsSchema(),
}, },
} }
} }
func resourceAwsNetworkInterfaceCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsNetworkInterfaceCreate(d *schema.ResourceData, meta interface{}) error {
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn
request := &ec2.CreateNetworkInterfaceRequest{ request := &ec2.CreateNetworkInterfaceRequest{
Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()), Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()),
SubnetID: aws.String(d.Get("subnet_id").(string)), SubnetID: aws.String(d.Get("subnet_id").(string)),
PrivateIPAddresses: expandPrivateIPAddesses(d.Get("private_ips").(*schema.Set).List()), PrivateIPAddresses: expandPrivateIPAddesses(d.Get("private_ips").(*schema.Set).List()),
} }
log.Printf("[DEBUG] Creating network interface") log.Printf("[DEBUG] Creating network interface")
resp, err := ec2conn.CreateNetworkInterface(request) resp, err := ec2conn.CreateNetworkInterface(request)
if err != nil { if err != nil {
@ -95,14 +95,14 @@ func resourceAwsNetworkInterfaceCreate(d *schema.ResourceData, meta interface{})
d.SetId(*resp.NetworkInterface.NetworkInterfaceID) d.SetId(*resp.NetworkInterface.NetworkInterfaceID)
log.Printf("[INFO] ENI ID: %s", d.Id()) log.Printf("[INFO] ENI ID: %s", d.Id())
return resourceAwsNetworkInterfaceUpdate(d, meta) return resourceAwsNetworkInterfaceUpdate(d, meta)
} }
func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) error {
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn
describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{ describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{
NetworkInterfaceIDs: []string{d.Id()}, NetworkInterfaceIDs: []string{d.Id()},
} }
describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request) describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request)
@ -112,7 +112,7 @@ func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
d.SetId("") d.SetId("")
return nil return nil
} }
return fmt.Errorf("Error retrieving ENI: %s", err) return fmt.Errorf("Error retrieving ENI: %s", err)
} }
if len(describeResp.NetworkInterfaces) != 1 { if len(describeResp.NetworkInterfaces) != 1 {
@ -125,41 +125,42 @@ func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
d.Set("security_groups", flattenGroupIdentifiers(eni.Groups)) d.Set("security_groups", flattenGroupIdentifiers(eni.Groups))
if eni.Attachment != nil { if eni.Attachment != nil {
d.Set("attachment", flattenAttachment(eni.Attachment)) attachment := []map[string]interface{} { flattenAttachment(eni.Attachment) }
d.Set("attachment", attachment)
} else { } else {
d.Set("attachment", nil) d.Set("attachment", nil)
} }
return nil return nil
} }
func networkInterfaceAttachmentRefreshFunc(ec2conn *ec2.EC2, id string) resource.StateRefreshFunc { func networkInterfaceAttachmentRefreshFunc(ec2conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) { return func() (interface{}, string, error) {
describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{ describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{
NetworkInterfaceIDs: []string{id}, NetworkInterfaceIDs: []string{id},
} }
describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request) describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request)
if err != nil { if err != nil {
log.Printf("[ERROR] Could not find network interface %s. %s", id, err) log.Printf("[ERROR] Could not find network interface %s. %s", id, err)
return nil, "", err return nil, "", err
} }
eni := describeResp.NetworkInterfaces[0] eni := describeResp.NetworkInterfaces[0]
hasAttachment := strconv.FormatBool(eni.Attachment != nil) hasAttachment := strconv.FormatBool(eni.Attachment != nil)
log.Printf("[DEBUG] ENI %s has attachment state %s", id, hasAttachment) log.Printf("[DEBUG] ENI %s has attachment state %s", id, hasAttachment)
return eni, hasAttachment, nil return eni, hasAttachment, nil
} }
} }
func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId string) error { func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId string) error {
// if there was an old attachment, remove it // if there was an old attachment, remove it
if oa != nil && len(oa.List()) > 0 { if oa != nil && len(oa.List()) > 0 {
old_attachment := oa.List()[0].(map[string]interface{}) old_attachment := oa.List()[0].(map[string]interface{})
detach_request := &ec2.DetachNetworkInterfaceRequest{ detach_request := &ec2.DetachNetworkInterfaceRequest{
AttachmentID: aws.String(old_attachment["attachment_id"].(string)), AttachmentID: aws.String(old_attachment["attachment_id"].(string)),
Force: aws.Boolean(true), Force: aws.Boolean(true),
} }
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn
detach_err := ec2conn.DetachNetworkInterface(detach_request) detach_err := ec2conn.DetachNetworkInterface(detach_request)
@ -175,9 +176,9 @@ func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId s
Timeout: 10 * time.Minute, Timeout: 10 * time.Minute,
} }
if _, err := stateConf.WaitForState(); err != nil { if _, err := stateConf.WaitForState(); err != nil {
return fmt.Errorf( return fmt.Errorf(
"Error waiting for ENI (%s) to become dettached: %s", eniId, err) "Error waiting for ENI (%s) to become dettached: %s", eniId, err)
} }
} }
return nil return nil
@ -189,20 +190,20 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
if d.HasChange("attachment") { if d.HasChange("attachment") {
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn
oa, na := d.GetChange("attachment") oa, na := d.GetChange("attachment")
detach_err := resourceAwsNetworkInterfaceDetach(oa.(*schema.Set), meta, d.Id()) detach_err := resourceAwsNetworkInterfaceDetach(oa.(*schema.Set), meta, d.Id())
if detach_err != nil { if detach_err != nil {
return detach_err return detach_err
} }
// if there is a new attachment, attach it // if there is a new attachment, attach it
if na != nil && len(na.(*schema.Set).List()) > 0 { if na != nil && len(na.(*schema.Set).List()) > 0 {
new_attachment := na.(*schema.Set).List()[0].(map[string]interface{}) new_attachment := na.(*schema.Set).List()[0].(map[string]interface{})
attach_request := &ec2.AttachNetworkInterfaceRequest{ attach_request := &ec2.AttachNetworkInterfaceRequest{
DeviceIndex: aws.Integer(new_attachment["device_index"].(int)), DeviceIndex: aws.Integer(new_attachment["device_index"].(int)),
InstanceID: aws.String(new_attachment["instance"].(string)), InstanceID: aws.String(new_attachment["instance"].(string)),
NetworkInterfaceID: aws.String(d.Id()), NetworkInterfaceID: aws.String(d.Id()),
} }
_, attach_err := ec2conn.AttachNetworkInterface(attach_request) _, attach_err := ec2conn.AttachNetworkInterface(attach_request)
if attach_err != nil { if attach_err != nil {
@ -215,8 +216,8 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
if d.HasChange("security_groups") { if d.HasChange("security_groups") {
request := &ec2.ModifyNetworkInterfaceAttributeRequest{ request := &ec2.ModifyNetworkInterfaceAttributeRequest{
NetworkInterfaceID: aws.String(d.Id()), NetworkInterfaceID: aws.String(d.Id()),
Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()), Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()),
} }
ec2conn := meta.(*AWSClient).ec2conn ec2conn := meta.(*AWSClient).ec2conn

View File

@ -1,7 +1,7 @@
package aws package aws
import ( import (
"fmt" "fmt"
"testing" "testing"
"github.com/hashicorp/aws-sdk-go/aws" "github.com/hashicorp/aws-sdk-go/aws"
@ -12,7 +12,7 @@ import (
func TestAccAWSENI_basic(t *testing.T) { func TestAccAWSENI_basic(t *testing.T) {
var conf ec2.NetworkInterface var conf ec2.NetworkInterface
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders, Providers: testAccProviders,
@ -22,7 +22,7 @@ func TestAccAWSENI_basic(t *testing.T) {
Config: testAccAWSENIConfig, Config: testAccAWSENIConfig,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckAWSENIExists("aws_network_interface.bar", &conf), testAccCheckAWSENIExists("aws_network_interface.bar", &conf),
testAccCheckAWSENIAttributes(&conf), testAccCheckAWSENIAttributes(&conf),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_network_interface.bar", "private_ips.#", "1"), "aws_network_interface.bar", "private_ips.#", "1"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -35,7 +35,7 @@ func TestAccAWSENI_basic(t *testing.T) {
func TestAccAWSENI_attached(t *testing.T) { func TestAccAWSENI_attached(t *testing.T) {
var conf ec2.NetworkInterface var conf ec2.NetworkInterface
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders, Providers: testAccProviders,
@ -45,7 +45,7 @@ func TestAccAWSENI_attached(t *testing.T) {
Config: testAccAWSENIConfigWithAttachment, Config: testAccAWSENIConfigWithAttachment,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckAWSENIExists("aws_network_interface.bar", &conf), testAccCheckAWSENIExists("aws_network_interface.bar", &conf),
testAccCheckAWSENIAttributesWithAttachment(&conf), testAccCheckAWSENIAttributesWithAttachment(&conf),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"aws_network_interface.bar", "private_ips.#", "1"), "aws_network_interface.bar", "private_ips.#", "1"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
@ -57,7 +57,7 @@ func TestAccAWSENI_attached(t *testing.T) {
} }
func testAccCheckAWSENIExists(n string, res *ec2.NetworkInterface) resource.TestCheckFunc { func testAccCheckAWSENIExists(n string, res *ec2.NetworkInterface) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n] rs, ok := s.RootModule().Resources[n]
if !ok { if !ok {
return fmt.Errorf("Not found: %s", n) return fmt.Errorf("Not found: %s", n)
@ -68,8 +68,8 @@ func testAccCheckAWSENIExists(n string, res *ec2.NetworkInterface) resource.Test
} }
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{ describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{
NetworkInterfaceIDs: []string{rs.Primary.ID}, NetworkInterfaceIDs: []string{rs.Primary.ID},
} }
describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request) describeResp, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request)
@ -90,9 +90,9 @@ func testAccCheckAWSENIExists(n string, res *ec2.NetworkInterface) resource.Test
func testAccCheckAWSENIAttributes(conf *ec2.NetworkInterface) resource.TestCheckFunc { func testAccCheckAWSENIAttributes(conf *ec2.NetworkInterface) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
if conf.Attachment != nil { if conf.Attachment != nil {
return fmt.Errorf("expected attachment to be nil") return fmt.Errorf("expected attachment to be nil")
} }
if *conf.AvailabilityZone != "us-west-2a" { if *conf.AvailabilityZone != "us-west-2a" {
@ -108,18 +108,18 @@ func testAccCheckAWSENIAttributes(conf *ec2.NetworkInterface) resource.TestCheck
} }
return nil return nil
} }
} }
func testAccCheckAWSENIAttributesWithAttachment(conf *ec2.NetworkInterface) resource.TestCheckFunc { func testAccCheckAWSENIAttributesWithAttachment(conf *ec2.NetworkInterface) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
if conf.Attachment == nil { if conf.Attachment == nil {
return fmt.Errorf("expected attachment to be set, but was nil") return fmt.Errorf("expected attachment to be set, but was nil")
} }
if *conf.Attachment.DeviceIndex != 1 { if *conf.Attachment.DeviceIndex != 1 {
return fmt.Errorf("expected attachment device index to be 1, but was %d", *conf.Attachment.DeviceIndex) return fmt.Errorf("expected attachment device index to be 1, but was %d", *conf.Attachment.DeviceIndex)
} }
if *conf.AvailabilityZone != "us-west-2a" { if *conf.AvailabilityZone != "us-west-2a" {
@ -135,7 +135,7 @@ func testAccCheckAWSENIAttributesWithAttachment(conf *ec2.NetworkInterface) reso
} }
return nil return nil
} }
} }
func testAccCheckAWSENIDestroy(s *terraform.State) error { func testAccCheckAWSENIDestroy(s *terraform.State) error {
@ -145,8 +145,8 @@ func testAccCheckAWSENIDestroy(s *terraform.State) error {
} }
ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn ec2conn := testAccProvider.Meta().(*AWSClient).ec2conn
describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{ describe_network_interfaces_request := &ec2.DescribeNetworkInterfacesRequest{
NetworkInterfaceIDs: []string{rs.Primary.ID}, NetworkInterfaceIDs: []string{rs.Primary.ID},
} }
_, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request) _, err := ec2conn.DescribeNetworkInterfaces(describe_network_interfaces_request)
@ -156,13 +156,12 @@ func testAccCheckAWSENIDestroy(s *terraform.State) error {
} }
return err return err
} }
} }
return nil return nil
} }
const testAccAWSENIConfig = ` const testAccAWSENIConfig = `
resource "aws_vpc" "foo" { resource "aws_vpc" "foo" {
cidr_block = "172.16.0.0/16" cidr_block = "172.16.0.0/16"
@ -233,4 +232,4 @@ resource "aws_network_interface" "bar" {
Name = "bar_interface" Name = "bar_interface"
} }
} }
` `

View File

@ -221,21 +221,21 @@ func expandPrivateIPAddesses(ips []interface{}) []ec2.PrivateIPAddressSpecificat
dtos := make([]ec2.PrivateIPAddressSpecification, 0, len(ips)) dtos := make([]ec2.PrivateIPAddressSpecification, 0, len(ips))
for i, v := range ips { for i, v := range ips {
new_private_ip := ec2.PrivateIPAddressSpecification{ new_private_ip := ec2.PrivateIPAddressSpecification{
PrivateIPAddress: aws.String(v.(string)), PrivateIPAddress: aws.String(v.(string)),
} }
new_private_ip.Primary = aws.Boolean(i == 0) new_private_ip.Primary = aws.Boolean(i == 0)
dtos = append(dtos, new_private_ip) dtos = append(dtos, new_private_ip)
} }
return dtos return dtos
} }
//Flattens network interface attachment into a map[string]interface //Flattens network interface attachment into a map[string]interface
func flattenAttachment(a *ec2.NetworkInterfaceAttachment) map[string]interface{} { func flattenAttachment(a *ec2.NetworkInterfaceAttachment) map[string]interface{} {
att := make(map[string]interface{}) att := make(map[string]interface{})
att["instance"] = *a.InstanceID att["instance"] = *a.InstanceID
att["device_index"] = *a.DeviceIndex att["device_index"] = *a.DeviceIndex
att["attachment_id"] = *a.AttachmentID att["attachment_id"] = *a.AttachmentID
return att return att
} }

View File

@ -271,9 +271,9 @@ func TestExpandInstanceString(t *testing.T) {
} }
func TestFlattenNetworkInterfacesPrivateIPAddesses(t *testing.T) { func TestFlattenNetworkInterfacesPrivateIPAddesses(t *testing.T) {
expanded := []ec2.NetworkInterfacePrivateIPAddress { expanded := []ec2.NetworkInterfacePrivateIPAddress{
ec2.NetworkInterfacePrivateIPAddress { PrivateIPAddress: aws.String("192.168.0.1") }, ec2.NetworkInterfacePrivateIPAddress{PrivateIPAddress: aws.String("192.168.0.1")},
ec2.NetworkInterfacePrivateIPAddress { PrivateIPAddress: aws.String("192.168.0.2") }, ec2.NetworkInterfacePrivateIPAddress{PrivateIPAddress: aws.String("192.168.0.2")},
} }
result := flattenNetworkInterfacesPrivateIPAddesses(expanded) result := flattenNetworkInterfacesPrivateIPAddesses(expanded)
@ -296,9 +296,9 @@ func TestFlattenNetworkInterfacesPrivateIPAddesses(t *testing.T) {
} }
func TestFlattenGroupIdentifiers(t *testing.T) { func TestFlattenGroupIdentifiers(t *testing.T) {
expanded := []ec2.GroupIdentifier { expanded := []ec2.GroupIdentifier{
ec2.GroupIdentifier { GroupID: aws.String("sg-001") }, ec2.GroupIdentifier{GroupID: aws.String("sg-001")},
ec2.GroupIdentifier { GroupID: aws.String("sg-002") }, ec2.GroupIdentifier{GroupID: aws.String("sg-002")},
} }
result := flattenGroupIdentifiers(expanded) result := flattenGroupIdentifiers(expanded)
@ -317,10 +317,10 @@ func TestFlattenGroupIdentifiers(t *testing.T) {
} }
func TestExpandPrivateIPAddesses(t *testing.T) { func TestExpandPrivateIPAddesses(t *testing.T) {
ip1 := "192.168.0.1" ip1 := "192.168.0.1"
ip2 := "192.168.0.2" ip2 := "192.168.0.2"
flattened := []interface{} { flattened := []interface{}{
ip1, ip1,
ip2, ip2,
} }
@ -330,7 +330,7 @@ func TestExpandPrivateIPAddesses(t *testing.T) {
if len(result) != 2 { if len(result) != 2 {
t.Fatalf("expected result had %d elements, but got %d", 2, len(result)) t.Fatalf("expected result had %d elements, but got %d", 2, len(result))
} }
if *result[0].PrivateIPAddress != "192.168.0.1" || !*result[0].Primary { if *result[0].PrivateIPAddress != "192.168.0.1" || !*result[0].Primary {
t.Fatalf("expected ip to be 192.168.0.1 and Primary, but got %v, %b", *result[0].PrivateIPAddress, *result[0].Primary) t.Fatalf("expected ip to be 192.168.0.1 and Primary, but got %v, %b", *result[0].PrivateIPAddress, *result[0].Primary)
} }
@ -342,8 +342,8 @@ func TestExpandPrivateIPAddesses(t *testing.T) {
func TestFlattenAttachment(t *testing.T) { func TestFlattenAttachment(t *testing.T) {
expanded := &ec2.NetworkInterfaceAttachment{ expanded := &ec2.NetworkInterfaceAttachment{
InstanceID: aws.String("i-00001"), InstanceID: aws.String("i-00001"),
DeviceIndex: aws.Integer(1), DeviceIndex: aws.Integer(1),
AttachmentID: aws.String("at-002"), AttachmentID: aws.String("at-002"),
} }
@ -364,4 +364,4 @@ func TestFlattenAttachment(t *testing.T) {
if result["attachment_id"] != "at-002" { if result["attachment_id"] != "at-002" {
t.Fatalf("expected attachment_id to be at-002, but got %s", result["attachment_id"]) t.Fatalf("expected attachment_id to be at-002, but got %s", result["attachment_id"])
} }
} }