providers/google: add external_address; needed for connection

This commit is contained in:
stungtoat 2014-10-18 23:03:37 -07:00
parent b25a536299
commit fd979d0a8e
1 changed files with 10 additions and 1 deletions

View File

@ -95,11 +95,15 @@ func resourceComputeInstance() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"internal_address": &schema.Schema{ "internal_address": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"external_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
}, },
}, },
}, },
@ -338,6 +342,11 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
for i, iface := range instance.NetworkInterfaces { for i, iface := range instance.NetworkInterfaces {
prefix := fmt.Sprintf("network.%d", i) prefix := fmt.Sprintf("network.%d", i)
d.Set(prefix+".name", iface.Name) d.Set(prefix+".name", iface.Name)
if len(iface.AccessConfigs) > 0 {
// Get the first one.
d.Set(prefix+".external_address", iface.AccessConfigs[0].NatIP)
}
d.Set(prefix+".internal_address", iface.NetworkIP) d.Set(prefix+".internal_address", iface.NetworkIP)
} }