Merge branch 'feat/ipv6-attrs' of git://github.com/ellsclytn/terraform-provider-docker into ellsclytn-feat/ipv6-attrs

This commit is contained in:
Manuel Vogel 2020-10-11 12:36:36 +02:00
commit cdc0d912cc
No known key found for this signature in database
GPG key ID: 24E54F214569A8A5
4 changed files with 34 additions and 6 deletions

View file

@ -143,7 +143,6 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
@ -151,7 +150,6 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
@ -160,7 +158,6 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
@ -194,7 +191,6 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"capabilities": {
Type: schema.TypeSet,
@ -459,6 +455,7 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
@ -516,6 +513,18 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"global_ipv6_address": {
Type: schema.TypeString,
Computed: true,
},
"global_ipv6_prefix_length": {
Type: schema.TypeInt,
Computed: true,
},
"ipv6_gateway": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
@ -562,6 +571,7 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Computed: true,
Elem: labelSchema,
},
@ -601,13 +611,12 @@ func resourceDockerContainer() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Default: "json-file",
},
"log_opts": {
Type: schema.TypeMap,
Optional: true,
Computed: true,
ForceNew: true,
},

View file

@ -842,6 +842,9 @@ func flattenContainerNetworks(in *types.NetworkSettings) []interface{} {
m["ip_address"] = networkData.IPAddress
m["ip_prefix_length"] = networkData.IPPrefixLen
m["gateway"] = networkData.Gateway
m["global_ipv6_address"] = networkData.GlobalIPv6Address
m["global_ipv6_prefix_length"] = networkData.GlobalIPv6PrefixLen
m["ipv6_gateway"] = networkData.IPv6Gateway
out = append(out, m)
}
return out

View file

@ -1449,6 +1449,9 @@ func TestAccDockerContainer_ipv6address(t *testing.T) {
testAccContainerRunning("docker_container.foo", &c),
testCheck,
resource.TestCheckResourceAttr("docker_container.foo", "name", "tf-test"),
resource.TestCheckResourceAttr("docker_container.foo", "network_data.0.global_ipv6_address", "fd00:0:0:0::123"),
resource.TestCheckResourceAttr("docker_container.foo", "network_data.0.global_ipv6_prefix_length", "64"),
resource.TestCheckResourceAttr("docker_container.foo", "network_data.0.ipv6_gateway", "fd00:0:0:0::f"),
),
},
},
@ -2138,6 +2141,7 @@ resource "docker_network" "test" {
ipv6 = true
ipam_config {
subnet = "fd00::1/64"
gateway = "fd00:0:0:0::f"
}
}
resource "docker_image" "foo" {

View file

@ -501,6 +501,18 @@ func resourceDockerContainerV1() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"global_ipv6_address": {
Type: schema.TypeString,
Computed: true,
},
"global_ipv6_prefix_length": {
Type: schema.TypeInt,
Computed: true,
},
"ipv6_gateway": {
Type: schema.TypeString,
Computed: true,
},
},
},
},