Back to Packer

`variable` block

website/content/docs/templates/hcl_templates/blocks/variable.mdx

1.15.31.6 KB
Original Source

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

[!IMPORTANT]
Documentation Update: Product documentation previously located in /website has moved to the hashicorp/web-unified-docs repository, where all product documentation is now centralized. Please make contributions directly to web-unified-docs, since changes to /website in this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

variable block

This topic provides reference information about the variable block.

Description

The variable and input-variable blocks define variables within your Packer configuration. You cannot use the input-variable block in another input-variable block. We recommend using the locals to nest variables 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