reading the aws instance it was assumed that eth0 was the first in the list of network interfaces (#6761)
This commit is contained in:
parent
f3a3cfab73
commit
c1eee521f3
|
@ -488,7 +488,11 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.Set("iam_instance_profile", iamInstanceProfileArnToName(instance.IamInstanceProfile))
|
d.Set("iam_instance_profile", iamInstanceProfileArnToName(instance.IamInstanceProfile))
|
||||||
|
|
||||||
if len(instance.NetworkInterfaces) > 0 {
|
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 {
|
} else {
|
||||||
d.Set("subnet_id", instance.SubnetId)
|
d.Set("subnet_id", instance.SubnetId)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue