Add docker container network settings to output attribute

This commit is contained in:
Stephan Epping 2015-04-16 15:21:14 +02:00 committed by Paul Hinze
parent 97482f8b0c
commit c2319da1aa
2 changed files with 26 additions and 0 deletions

View File

@ -116,6 +116,26 @@ func resourceDockerContainer() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
Set: stringSetHash,
},
"ip_address": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"ip_prefix_length": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"gateway": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"bridge": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}

View File

@ -138,6 +138,12 @@ func resourceDockerContainerRead(d *schema.ResourceData, meta interface{}) error
return resourceDockerContainerDelete(d, meta)
}
// Read Network Settings
d.Set("ip_address", container.NetworkSettings.IPAddress)
d.Set("ip_prefix_length", container.NetworkSettings.IPPrefixLen)
d.Set("gateway", container.NetworkSettings.Gateway)
d.Set("bridge", container.NetworkSettings.Bridge)
return nil
}