Skip to content

Commit

Permalink
More note on variable interpolation support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Mar 13, 2016
1 parent ec80b2e commit 05312e5
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ Add `json-updater` type to Packer template's post-processor section:
],
"templates/child_template_2.json": [
"variables.aws_source_ami"
],
"templates/child_template_3.json": [
"{{ build_name }}.aws_source_ami"
],
]
}
}
]
Expand All @@ -46,4 +43,24 @@ The above `ami_id` configuration indicates that the ID of the newly created AWS
"aws_source_ami": "<ami_id>"
}

You can use Configuration Templates, they will be expanded upon Template build time.
Variable interpolation is also supported:

"variables": {
"build_id": "build_123"
},
"post-processors": [
{
"type": "json-updater",
"ami_id": {
"templates/child_template_3.json": [
"variables.aws_source_ami_{{user `build_id` }}"
],
}
}
]

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.

"variables": {
"aws_source_ami_build_123": "<ami_id>"
}

0 comments on commit 05312e5

Please sign in to comment.