mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-27 10:14:01 -04:00
* Adding check-legacy-links-format workflow * Adding test-link-rewrites workflow * Migrating links to new format * Updating docs-content-check-legacy-links-format hash * chore: update source * Update generated partials from Packer plugin SDK * Bump packer-plugin-sdk to get latest packer-sdc * Update website/content/docs/templates/hcl_templates/blocks/build/provisioner.mdx * Update Plugin SDK to fix shell-local regression --------- Co-authored-by: Kendall Strautman <[email protected]> Co-authored-by: Wilken Rivera <[email protected]> Co-authored-by: Kendall Strautman <[email protected]>
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
---
|
|
description: >
|
|
The variable block, also called the input-variable block, defines variables
|
|
within your Packer configuration.
|
|
page_title: variable - Blocks
|
|
---
|
|
|
|
# The `variable` block
|
|
|
|
`@include 'from-1.5/beta-hcl2-note.mdx'`
|
|
|
|
The `variable` block, also called the `input-variable` block, defines variables
|
|
within your Packer configuration. An input-variable cannot be used in another
|
|
input variable: we recommend using [locals](/packer/docs/templates/hcl_templates/blocks/locals) for that instead.
|
|
|
|
`@include 'from-1.5/variables/foo-block.mdx'`
|
|
|
|
## Default value
|
|
|
|
If a default value is set, the variable is optional. Otherwise, the variable
|
|
**must** be set.
|
|
|
|
`@include 'from-1.5/variables/assignment.mdx'`
|
|
|
|
`@include 'from-1.5/variables/custom-validation.mdx'`
|
|
|
|
Example of a variable assignment from a file:
|
|
|
|
`@include 'from-1.5/variables/foo-pkrvar.mdx'`
|
|
|
|
`@include 'from-1.5/variables/must-be-set.mdx'`
|
|
|
|
`@include 'from-1.5/variables/sensitive.mdx'`
|
|
|
|
# More on variables
|
|
|
|
- Read the [full variables](/packer/docs/templates/hcl_templates/variables) description for a more
|
|
thorough read.
|
|
- Read the [variables guide](/packer/guides/hcl/variables) for more examples.
|