mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-31 12:10:27 -05:00
migrate the container resource
This commit is contained in:
parent
cfb13bb532
commit
e391230447
3 changed files with 13 additions and 8 deletions
|
|
@ -256,10 +256,10 @@ func resourceDockerContainer() *schema.Resource {
|
|||
Optional: true,
|
||||
},
|
||||
"labels": {
|
||||
Type: schema.TypeMap,
|
||||
Type: schema.TypeSet,
|
||||
Description: "User-defined key/value metadata",
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Elem: labelSchema,
|
||||
},
|
||||
"driver_name": {
|
||||
Type: schema.TypeString,
|
||||
|
|
@ -536,9 +536,10 @@ func resourceDockerContainer() *schema.Resource {
|
|||
},
|
||||
|
||||
"labels": {
|
||||
Type: schema.TypeMap,
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Elem: labelSchema,
|
||||
},
|
||||
|
||||
"memory": {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
|||
}
|
||||
|
||||
if v, ok := d.GetOk("labels"); ok {
|
||||
config.Labels = mapTypeMapValsToString(v.(map[string]interface{}))
|
||||
config.Labels = labelSetToMap(v.(*schema.Set))
|
||||
}
|
||||
|
||||
if value, ok := d.GetOk("healthcheck"); ok {
|
||||
|
|
@ -168,7 +168,7 @@ func resourceDockerContainerCreate(d *schema.ResourceData, meta interface{}) err
|
|||
mountInstance.VolumeOptions.NoCopy = value.(bool)
|
||||
}
|
||||
if value, ok := rawVolumeOptions["labels"]; ok {
|
||||
mountInstance.VolumeOptions.Labels = mapTypeMapValsToString(value.(map[string]interface{}))
|
||||
mountInstance.VolumeOptions.Labels = labelSetToMap(value.(*schema.Set))
|
||||
}
|
||||
// because it is not possible to nest maps
|
||||
if value, ok := rawVolumeOptions["driver_name"]; ok {
|
||||
|
|
|
|||
|
|
@ -1660,9 +1660,13 @@ resource "docker_container" "foo" {
|
|||
dns = ["8.8.8.8"]
|
||||
dns_opts = ["rotate"]
|
||||
dns_search = ["example.com"]
|
||||
labels = {
|
||||
env = "prod"
|
||||
role = "test"
|
||||
labels {
|
||||
label = "env"
|
||||
value = "prod"
|
||||
}
|
||||
labels {
|
||||
label = "role"
|
||||
value = "test"
|
||||
}
|
||||
log_driver = "json-file"
|
||||
log_opts = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue