Skip to content

Commit 05312e5

Browse files
committed
More note on variable interpolation support.
1 parent ec80b2e commit 05312e5

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ Add `json-updater` type to Packer template's post-processor section:
3232
],
3333
"templates/child_template_2.json": [
3434
"variables.aws_source_ami"
35-
],
36-
"templates/child_template_3.json": [
37-
"{{ build_name }}.aws_source_ami"
38-
],
35+
]
3936
}
4037
}
4138
]
@@ -46,4 +43,24 @@ The above `ami_id` configuration indicates that the ID of the newly created AWS
4643
"aws_source_ami": "<ami_id>"
4744
}
4845

49-
You can use Configuration Templates, they will be expanded upon Template build time.
46+
Variable interpolation is also supported:
47+
48+
"variables": {
49+
"build_id": "build_123"
50+
},
51+
"post-processors": [
52+
{
53+
"type": "json-updater",
54+
"ami_id": {
55+
"templates/child_template_3.json": [
56+
"variables.aws_source_ami_{{user `build_id` }}"
57+
],
58+
}
59+
}
60+
]
61+
62+
The above `ami_id` configuration indicates that the ID of the newly created AWS AMI will be set as the value of `variables.aws_source_ami_build_123` key in `templates/child_template_3.json` file.
63+
64+
"variables": {
65+
"aws_source_ami_build_123": "<ami_id>"
66+
}

0 commit comments

Comments
 (0)