mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
feat: Add sysctl implementation to container of docker_service. (#499)
This commit is contained in:
parent
b30ba0c07c
commit
19191883d5
3 changed files with 13 additions and 0 deletions
|
|
@ -378,6 +378,7 @@ Optional:
|
|||
- `secrets` (Block Set) References to zero or more secrets that will be exposed to the service (see [below for nested schema](#nestedblock--task_spec--container_spec--secrets))
|
||||
- `stop_grace_period` (String) Amount of time to wait for the container to terminate before forcefully removing it (ms|s|m|h). If not specified or '0s' the destroy will not check if all tasks/containers of the service terminate.
|
||||
- `stop_signal` (String) Signal to stop the container
|
||||
- `sysctl` (Map of String) Sysctls config (Linux only)
|
||||
- `user` (String) The user inside the container
|
||||
|
||||
<a id="nestedblock--task_spec--container_spec--configs"></a>
|
||||
|
|
|
|||
|
|
@ -499,6 +499,12 @@ func resourceDockerService() *schema.Resource {
|
|||
Optional: true,
|
||||
ValidateDiagFunc: validateStringMatchesPattern(`^(default|process|hyperv)$`),
|
||||
},
|
||||
"sysctl": {
|
||||
Type: schema.TypeMap,
|
||||
Description: "Sysctls config (Linux only)",
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -174,6 +174,9 @@ func flattenContainerSpec(in *swarm.ContainerSpec) []interface{} {
|
|||
if len(in.Isolation) > 0 {
|
||||
m["isolation"] = string(in.Isolation)
|
||||
}
|
||||
if len(in.Sysctls) > 0 {
|
||||
m["sysctl"] = in.Sysctls
|
||||
}
|
||||
out = append(out, m)
|
||||
return out
|
||||
}
|
||||
|
|
@ -925,6 +928,9 @@ func createContainerSpec(v interface{}) (*swarm.ContainerSpec, error) {
|
|||
if value, ok := rawContainerSpec["isolation"]; ok {
|
||||
containerSpec.Isolation = container.Isolation(value.(string))
|
||||
}
|
||||
if value, ok := rawContainerSpec["sysctl"]; ok {
|
||||
containerSpec.Sysctls = mapTypeMapValsToString(value.(map[string]interface{}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue