Skip to content

Commit

Permalink
Document the differences between the Nomad job specification and the …
Browse files Browse the repository at this point in the history
…Terraform schema
  • Loading branch information
remilapeyre committed Sep 29, 2020
1 parent d64fceb commit afa62a7
Showing 1 changed file with 87 additions and 15 deletions.
102 changes: 87 additions & 15 deletions website/docs/r/job_v2.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,96 @@ Registering a job from a jobspec file:
```hcl
resource "nomad_job_v2" "app" {
job {
name = "example"
datacenters = ["dc1"]
group {
name = "cache"
task {
name = "redis"
driver = "docker"
config = jsonencode({
image = "redis:3.2"
})
}
}
}
name = "example"
datacenters = ["dc1"]
group {
name = "cache"
task {
name = "redis"
driver = "docker"
config = jsonencode({
image = "redis:3.2"
})
}
}
}
}
```

The attribute `job` supports the same attributes as the [Nomad Job specification](https://www.nomadproject.io/docs/job-specification)
with the exception of the stanza having an ID:

```hcl
resource "nomad_job_v2" "app" {
job {
# instead of having
# job "the-job-id" {
# ...
# }
# the id can be specified here:
id = "the-job-id"
name = "example"
datacenters = ["dc1"]
# group "cache" {} becomes:
group {
name = "cache"
# task "server" {} becomes:
task {
name = "redis"
driver = "docker"
config = jsonencode({
image = "redis:3.2"
})
resources {
# device "nvidia/gpu" {} becomes:
device {
name = "nvidia/gpu"
# ...
}
}
}
# volume "certs" {} becomes:
volume {
name = "certs"
# ...
}
network {
# port "http" {} becomes:
port {
label = "http"
# ...
}
}
spread {
attribute = "$${meta.rack}"
# target "r1" becomes:
target {
attribute = "r1"
percent = 60
}
target {
attribute = "r2"
percent = 40
}
}
}
}
}
```


## Argument Reference

The following arguments are supported:
Expand Down

0 comments on commit afa62a7

Please sign in to comment.