open-nomad/website/pages/docs/job-specification/hcl2/functions/file/abspath.mdx
Mahmood Ali d1e139c3fb
Docs for HCL2 (#9322)
Add more detailed HCL2 docs, mostly lifted from Packer with tweaks for Nomad.

The function docs are basically verbatim taken from Packer with basic string substitutions. I commented out some for_each details as the examples are mostly driven towards Packer resources. I'll iterate on those with better Nomad examples.
2020-11-29 20:36:41 -05:00

27 lines
852 B
Plaintext

---
layout: docs
page_title: abspath - Functions - Configuration Language
sidebar_title: abspath
description: The abspath function converts the argument to an absolute filesystem path.
---
# `abspath` Function
`abspath` takes a string containing a filesystem path and converts it
to an absolute path. That is, if the path is not absolute, it will be joined
with the job file directory.
Referring directly to filesystem paths in job arguments may cause spurious
diffs if the same configuration is applied from multiple systems or on
different host operating systems. We recommend using filesystem paths only for
transient values, such as the argument to
[`file`](/docs/job-specification/hcl2/functions/file/file) (where only the contents are then
stored).
## Examples
```shell-session
> abspath("nomad.txt")
/home/user/some/nomad-job/nomad.txt
```