Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: more notes about hcl2 compatibility #9634

Merged
merged 3 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions website/pages/docs/drivers/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ config {

```hcl
config {
sysctl {
net.core.somaxconn = "16384"
sysctl = {
"net.core.somaxconn" = "16384"
}
}
```
Expand Down Expand Up @@ -340,12 +340,12 @@ config {
target = "/path/in/container"
source = "name-of-volume"
readonly = false
volume_options {
volume_options = {
no_copy = false
labels {
labels = {
foo = "bar"
}
driver_config {
driver_config = {
name = "pxd"
options = {
foo = "bar"
Expand All @@ -359,7 +359,7 @@ config {
target = "/path/in/container"
source = "/path/in/host"
readonly = false
bind_options {
bind_options = {
propagation = "rshared"
}
},
Expand All @@ -368,7 +368,7 @@ config {
type = "tmpfs"
target = "/path/in/container"
readonly = false
tmpfs_options {
tmpfs_options = {
size = 100000 # size in bytes
}
}
Expand Down
45 changes: 42 additions & 3 deletions website/pages/docs/job-specification/hcl2/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,50 @@ meta {
Additionally, block attributes must be [HCL2 valid identifiers](https://github.com/hashicorp/hcl/blob/v2.8.0/hclsyntax/spec.md#identifiers).
Generally, identifiers may only contain letters, numbers, underscore `_`,
or a dash `-`, and start with a letter. Notable,
[`meta`](https://www.nomadproject.io/docs/job-specification/meta), and
[`env`](https://www.nomadproject.io/docs/job-specification/env) keys may not
[`meta`](/docs/job-specification/meta), and
[`env`](/docs/job-specification/env) keys may not
contain other symbols (e.g. `.`, `#`).

### Multiline "here doc" strings
Task driver config fields may require extra attention if they contain invalid
identifiers. For example, docker [`sysctl`](/docs/drivers/docker#sysctl) must
use the map assignment syntax if the keys aren't valid:

```hcl
sysctl = {
"net.core.somaxconn/docs/drivers/docker#sysctl" = "16384"
}
```

Additionally, task driver config fields may not nest block syntax within an
assignment syntax. The following [`mounts`](/docs/drivers/docker#mounts) syntax is no longer valid:

```hcl
# INVALID in Nomad 1.0
mounts = [
{
type = "tmpfs"
tmpfs_options { # <- block syntax is not valid here
size = 10000
}
}
]
```

Here, the `tmpfs_options` block declaration is invalid HCL2 syntax, and must be an assignment instead:

```hcl
# VALID in Nomad 1.0
mounts = [
{
type = "tmpfs"
tmpfs_options = {
size = 10000
}
}
]
```

### Multiline "here doc" string

Nomad supports multi-line string literals in the so-called "heredoc" style, inspired by Unix shell languages:

Expand Down