Skip to content

Commit

Permalink
reading the aws instance it was assumed that eth0 was the first in th…
Browse files Browse the repository at this point in the history
…e list of network interfaces (hashicorp#6761)
  • Loading branch information
Djuke authored and radeksimko committed May 29, 2016
1 parent f3a3cfa commit c1eee52
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin/providers/aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,11 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
d.Set("iam_instance_profile", iamInstanceProfileArnToName(instance.IamInstanceProfile))

if len(instance.NetworkInterfaces) > 0 {
d.Set("subnet_id", instance.NetworkInterfaces[0].SubnetId)
for _, ni := range instance.NetworkInterfaces {
if *ni.Attachment.DeviceIndex == 0 {
d.Set("subnet_id", ni.SubnetId)
}
}
} else {
d.Set("subnet_id", instance.SubnetId)
}
Expand Down

0 comments on commit c1eee52

Please sign in to comment.