syntax-json: Fix nested provisioner block example (#10109)

This commit is contained in:
Wilken Rivera 2020-10-15 10:04:01 -04:00 committed by GitHub
parent 2cdc052d7c
commit 343ac2d48d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 25 deletions

View File

@ -168,15 +168,15 @@ source "amazon-ebs" "example" {
When the nested block type requires one or more labels, or when multiple When the nested block type requires one or more labels, or when multiple
blocks of the same type can be given, the mapping gets a little more blocks of the same type can be given, the mapping gets a little more
complicated. For example, the `provisioner` nested block type used complicated. For example, the `provisioner` nested block type used
within `source` blocks expects a label giving the provisioner to use, within `build` blocks expects a label giving the provisioner to use,
and the ordering of provisioner blocks is significant to decide the order and the ordering of provisioner blocks is significant to decide the order
of operations. of operations.
The following native syntax example shows a `source` block with a number The following native syntax example shows a `build` block with a number
of provisioners of different types: of provisioners of different types:
```hcl ```hcl
source "amazon-ebs" "example" { build {
# (source configuration omitted for brevity) # (source configuration omitted for brevity)
provisioner "shell-local" { provisioner "shell-local" {
@ -200,29 +200,27 @@ this JSON equivalent of the above:
```json ```json
{ {
"source": { "build": {
"amazon-ebs": { "//": "(source configuration omitted for brevity)",
"example": {
"provisioner": [ "provisioner": [
{ {
"shell-local": { "shell-local": {
"inline": ["echo 'Hello World' >example.txt"] "inline": ["echo 'Hello World' >example.txt"]
} }
}, },
{ {
"file": { "file": {
"source": "example.txt", "source": "example.txt",
"destination": "/tmp/example.txt" "destination": "/tmp/example.txt"
} }
}, },
{ {
"shell": { "shell": {
"inline": ["sudo install-something -f /tmp/example.txt"] "inline": ["sudo install-something -f /tmp/example.txt"]
} }
}
]
} }
} ]
} }
} }
``` ```