feat(container): add MAC address to state (#523)

Co-authored-by: Gustavo Michels <gmichels@nanthealth.com>
Co-authored-by: Martin <Junkern@users.noreply.github.com>
This commit is contained in:
Gustavo Michels 2023-03-15 08:42:33 -04:00 committed by GitHub
parent a89059b6ca
commit b15ea021d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 0 deletions

View file

@ -290,6 +290,7 @@ Read-Only:
- `ip_address` (String)
- `ip_prefix_length` (Number)
- `ipv6_gateway` (String)
- `mac_address` (String)
- `network_name` (String)
## Import

View file

@ -615,6 +615,11 @@ func resourceDockerContainer() *schema.Resource {
Description: "The IPV6 gateway of the container.",
Computed: true,
},
"mac_address": {
Type: schema.TypeString,
Description: "The MAC address of the container.",
Computed: true,
},
},
},
},

View file

@ -546,6 +546,10 @@ func resourceDockerContainerV1() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"mac_address": {
Type: schema.TypeString,
Computed: true,
},
},
},
},

View file

@ -74,6 +74,7 @@ func flattenContainerNetworks(in *types.NetworkSettings) []interface{} {
m["global_ipv6_address"] = networkData.GlobalIPv6Address
m["global_ipv6_prefix_length"] = networkData.GlobalIPv6PrefixLen
m["ipv6_gateway"] = networkData.IPv6Gateway
m["mac_address"] = networkData.MacAddress
out = append(out, m)
}
return out

View file

@ -1508,6 +1508,7 @@ func TestAccDockerContainer_ipv4address(t *testing.T) {
testAccContainerRunning("docker_container.foo", &c),
testCheck,
resource.TestCheckResourceAttr("docker_container.foo", "name", "tf-test"),
resource.TestCheckResourceAttrSet("docker_container.foo", "network_data.0.mac_address"),
),
},
},