Merge pull request #1599 from hashicorp/1554-docker-network-settings
[repack] "Add docker container network settings to output attribute #1554"
This commit is contained in:
commit
ff224dec13
|
@ -116,6 +116,26 @@ func resourceDockerContainer() *schema.Resource {
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
Set: stringSetHash,
|
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,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,14 @@ func resourceDockerContainerRead(d *schema.ResourceData, meta interface{}) error
|
||||||
return resourceDockerContainerDelete(d, meta)
|
return resourceDockerContainerDelete(d, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read Network Settings
|
||||||
|
if container.NetworkSettings != nil {
|
||||||
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,3 +77,16 @@ the following:
|
||||||
is coming from.
|
is coming from.
|
||||||
* `read_only` - (Optinal, bool) If true, this volume will be readonly.
|
* `read_only` - (Optinal, bool) If true, this volume will be readonly.
|
||||||
Defaults to false.
|
Defaults to false.
|
||||||
|
|
||||||
|
## Attributes Reference
|
||||||
|
|
||||||
|
The following attributes are exported:
|
||||||
|
|
||||||
|
* `ip_address` - The IP address of the container as read from its
|
||||||
|
NetworkSettings.
|
||||||
|
* `ip_prefix_length` - The IP prefix length of the container as read from its
|
||||||
|
NetworkSettings.
|
||||||
|
* `gateway` - The network gateway of the container as read from its
|
||||||
|
NetworkSettings.
|
||||||
|
* `bridge` - The network bridge of the container as read from its
|
||||||
|
NetworkSettings.
|
||||||
|
|
Loading…
Reference in New Issue