mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
chore(docs): update file HCL function (#18696)
This commit is contained in:
@@ -9,7 +9,7 @@ description: |-
|
||||
# `file` Function
|
||||
|
||||
`file` reads the contents of a file at the given path and returns them as
|
||||
a string.
|
||||
a string. Relative paths will be resolved based on the CLI’s current working directory.
|
||||
|
||||
```hcl
|
||||
file(path)
|
||||
@@ -30,6 +30,31 @@ so this function can only be used with files that are already present on disk on
|
||||
Hello World
|
||||
```
|
||||
|
||||
Or in an example job specification:
|
||||
|
||||
```hcl
|
||||
# /path/to/example/jobspec.nomad
|
||||
job "test" {
|
||||
group "test" {
|
||||
task "test" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "test/image:latest"
|
||||
|
||||
volumes = [
|
||||
"local/file.txt:/path/to/file/on/container/file.txt"
|
||||
]
|
||||
}
|
||||
|
||||
template {
|
||||
data = file("/path/to/example/file.txt")
|
||||
destination = "local/file.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Related Functions
|
||||
|
||||
- [`fileexists`](/nomad/docs/job-specification/hcl2/functions/file/fileexists) determines whether a file exists
|
||||
|
||||
Reference in New Issue
Block a user