This commit is contained in:
Adrien Delorme 2019-12-19 16:23:30 +01:00
parent fbd3796377
commit 46ce0529dd
4 changed files with 17 additions and 29 deletions

View File

@ -135,19 +135,7 @@ The following named values are available:
* `source.<SOURCE TYPE>.<NAME>` is an object representing a
[source](./sources.html) of the given type
and name. The attributes of the source can be accessed using
[dot or square bracket notation][inpage-index].
Any named value that does not match another pattern listed below
will be interpreted by Packer as a reference to a managed source.
### Named Values and Dependencies
Constructs like resources and module calls often use references to named values
in their block bodies, and Packer analyzes these expressions to automatically
infer dependencies between objects. For example, an expression in a source
argument that refers to another managed source creates an implicit dependency
between the two resources.
and name.
## String Literals
@ -166,24 +154,24 @@ sequence, with the following characters selecting the escape behavior:
| `\uNNNN` | Unicode character from the basic multilingual plane (NNNN is four hex digits) |
| `\UNNNNNNNN` | Unicode character from supplementary planes (NNNNNNNN is eight hex digits) |
The alternative syntax for string literals is the so-called "heredoc" style,
inspired by Unix shell languages. This style allows multi-line strings to
be expressed more clearly by using a custom delimiter word on a line of its
own to close the string:
The alternative syntax for string literals is the so-called Here Documents or
"heredoc" style, inspired by Unix shell languages. This style allows multi-line
strings to be expressed more clearly by using a custom delimiter word on a line
of its own to close the string:
```hcl
<<EOT
<<EOF
hello
world
EOT
EOF
```
The `<<` marker followed by any identifier at the end of a line introduces the
sequence. Packer then processes the following lines until it finds one that
consists entirely of the identifier given in the introducer. In the above
example, `EOT` is the identifier selected. Any identifier is allowed, but
example, `EOF` is the identifier selected. Any identifier is allowed, but
conventionally this identifier is in all-uppercase and begins with `EO`, meaning
"end of". `EOT` in this case stands for "end of text".
"end of". `EOF` in this case stands for "end of text".
The "heredoc" form shown above requires that the lines following be flush with
the left margin, which can be awkward when an expression is inside an indented
@ -191,10 +179,10 @@ block:
```hcl
block {
value = <<EOT
value = <<EOF
hello
world
EOT
EOF
}
```
@ -203,10 +191,10 @@ that is introduced by the `<<-` sequence:
```hcl
block {
value = <<-EOT
value = <<-EOF
hello
world
EOT
EOF
}
```

View File

@ -32,7 +32,7 @@ of a specification called _HCL_. It is not necessary to know all of the details
of HCL syntax or its JSON mapping in order to use Packer, and so this page
summarizes the most important differences between native and JSON syntax. If
you are interested, you can find a full definition of HCL's JSON syntax in [its
specification](https://github.com/hashicorp/hcl2/blob/master/hcl/spec.md).
specification](https://github.com/hashicorp/hcl/blob/hcl2/hclsyntax/spec.md).
## JSON File Structure

View File

@ -17,7 +17,7 @@ are built from.
This page describes the _native syntax_ of HCL, which is a rich language
designed to be easy for humans to read and write. The constructs in HCL can
also be expressed in [JSON syntax](/syntax-json.html), which is harder for
also be expressed in [JSON syntax](./syntax-json.html), which is harder for
humans to read and edit but easier to generate and parse programmatically.
This low-level syntax of HCL is defined in terms of a syntax called _HCL_,
@ -47,7 +47,7 @@ after the equals sign is the argument's value.
The context where the argument appears determines what value types are valid
(for example, each source type has a schema that defines the types of its
arguments), but many arguments accept arbitrary
[expressions](/expressions.html), which allow the value to
[expressions](./expressions.html), which allow the value to
either be specified literally or generated from other values programmatically.
### Blocks

View File

@ -9,7 +9,7 @@
<a href="/docs/configuration/from-1.5/syntax.html">Syntax</a>
</li>
<li<%= sidebar_current("configuration-expressions") %>>
<a href="/docs/configuration/from-1.5/expression.html">Expressions</a>
<a href="/docs/configuration/from-1.5/expressions.html">Expressions</a>
</li>
<li<%= sidebar_current("configuration-json-syntax") %>>
<a href="/docs/configuration/from-1.5/syntax-json.html">JSON Syntax</a>