Skip to content

Commit

Permalink
Merge pull request #1458 from sparkprime/fix-network-source
Browse files Browse the repository at this point in the history
Avoid 'source' being undefined in legacy network Read
  • Loading branch information
phinze committed Apr 10, 2015
2 parents d90b3aa + d149db4 commit 8f5ac1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/providers/google/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
networks := make([]map[string]interface{}, 0, 1)
if networksCount > 0 {
// TODO: Remove this when realizing deprecation of .network
for _, iface := range instance.NetworkInterfaces {
for i, iface := range instance.NetworkInterfaces {
var natIP string
for _, config := range iface.AccessConfigs {
if config.Type == "ONE_TO_ONE_NAT" {
Expand All @@ -539,6 +539,7 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
network["name"] = iface.Name
network["external_address"] = natIP
network["internal_address"] = iface.NetworkIP
network["source"] = d.Get(fmt.Sprintf("network.%d.source", i))
networks = append(networks, network)
}
}
Expand Down

0 comments on commit 8f5ac1d

Please sign in to comment.