Add ability to set docker user for services
This commit is contained in:
parent
bd67c60575
commit
c5743a2578
@ -13,6 +13,7 @@ resource "nomad_job" "service" {
|
|||||||
job_meta = var.job_meta
|
job_meta = var.job_meta
|
||||||
constraints = var.constraints
|
constraints = var.constraints
|
||||||
docker_devices = var.docker_devices
|
docker_devices = var.docker_devices
|
||||||
|
user = var.user
|
||||||
|
|
||||||
service_port = var.service_port
|
service_port = var.service_port
|
||||||
service_port_static = var.service_port_static
|
service_port_static = var.service_port_static
|
||||||
|
@ -80,6 +80,9 @@ job "${name}" {
|
|||||||
|
|
||||||
task "${name}" {
|
task "${name}" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
%{~ if user != null }
|
||||||
|
user = "${user}"
|
||||||
|
%{~ endif ~}
|
||||||
%{~ if length(task_meta) > 0 }
|
%{~ if length(task_meta) > 0 }
|
||||||
meta = {
|
meta = {
|
||||||
%{ for k, v in task_meta ~}
|
%{ for k, v in task_meta ~}
|
||||||
|
@ -32,6 +32,12 @@ variable "image_pull_timeout" {
|
|||||||
description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image"
|
description = "A time duration that controls how long Nomad will wait before cancelling an in-progress pull of the Docker image"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "user" {
|
||||||
|
type = string
|
||||||
|
default = null
|
||||||
|
description = "User to be passed to the task driver for execution. [ user | user:group | uid | uid:gid | user:gid | uid:group ]"
|
||||||
|
}
|
||||||
|
|
||||||
variable "task_meta" {
|
variable "task_meta" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
default = {}
|
default = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user