mirror of https://github.com/hashicorp/packer
Merge pull request #13282 from hashicorp/docs/packer-seo-templates-batch1
Docs/packer seo templates batch1docs/packer-seo-final-batch
commit
0c0f7a6c41
@ -1,16 +1,13 @@
|
||||
---
|
||||
description: >
|
||||
The data block defines data sources within your Packer configuration.
|
||||
page_title: data - Blocks
|
||||
The `data` block defines data sources within your Packer configuration. Learn how to configure `data` blocks.
|
||||
page_title: data block referenece
|
||||
---
|
||||
|
||||
# The `data` block
|
||||
# `data` block
|
||||
|
||||
The `data` block defines data sources within your Packer configuration.
|
||||
The `data` block defines data sources within your Packer configuration. The following example instructs Packer to query the `amazon-ami` data source for information to use in the template.
|
||||
|
||||
`@include 'from-1.5/datasources/example-block.mdx'`
|
||||
|
||||
# More on data sources
|
||||
|
||||
- Read the [full Data Sources](/packer/docs/templates/hcl_templates/datasources) description for a more
|
||||
thorough read.
|
||||
Refer to [Data Sources](/packer/docs/templates/hcl_templates/datasources) for instructions about using the `data` block in your configuration.
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
---
|
||||
description: >
|
||||
The locals block also called the local-variable block defines locals within
|
||||
your Packer configuration.
|
||||
page_title: locals - Blocks
|
||||
The `locals` and `local-variable` blocks declare local variables in
|
||||
your Packer configuration. Learn how to use these blocks to declare local variables in your template.
|
||||
page_title: locals block reference
|
||||
---
|
||||
|
||||
# The `locals` block
|
||||
# `locals` block
|
||||
|
||||
`@include 'from-1.5/beta-hcl2-note.mdx'`
|
||||
This topic provides reference information about the `locals` block.
|
||||
|
||||
The `locals` block, also called the `local-variable` block, defines locals within
|
||||
## Description
|
||||
|
||||
The `locals` and `local-variable` blocks declare local variables in
|
||||
your Packer configuration.
|
||||
|
||||
`@include 'from-1.5/locals/example-block.mdx'`
|
||||
|
||||
# More on variables
|
||||
Refer to the following topics for additional information about using the `locals` and `local-variable` blocks:
|
||||
|
||||
- Read the [full locals](/packer/docs/templates/hcl_templates/locals) description for a more
|
||||
thorough read.
|
||||
- Read the [variables guide](/packer/guides/hcl/variables) for more examples.
|
||||
- [Local Variables](/packer/docs/templates/hcl_templates/locals)
|
||||
- [Input Variables and local variables](/packer/guides/hcl/variables)
|
||||
|
||||
@ -1,31 +1,26 @@
|
||||
---
|
||||
description: |
|
||||
This section describes the configuration language used to create Packer
|
||||
templates.
|
||||
page_title: Templates
|
||||
Packer templates are configuration files that determine Packer behavior. Learn about the Packer template configuration language.
|
||||
page_title: Packer templates reference overview
|
||||
---
|
||||
|
||||
# Packer Templates
|
||||
# Packer templates reference overview
|
||||
|
||||
Packer's behavior is determined by the Packer template, which consists of a
|
||||
series of declarations and commands for Packer to follow. This template tells
|
||||
Packer what plugins (builders, provisioners, post-processors) to use, how to
|
||||
configure each of those plugins, and what order to run them in.
|
||||
This topic provides overview information about Packer templates, which are configuration files that determine Packer behavior.
|
||||
|
||||
## Introduction
|
||||
|
||||
A Packer template contains a series of declarations and commands for Packer to follow. Templates define the following instructions for Packer:
|
||||
|
||||
- Which plugins, such as builders, provisioners, and post-processors to use
|
||||
- How to configure the plugins
|
||||
- In what order to run them
|
||||
|
||||
The template contains flexible variable injection tools, as well as built-in
|
||||
functions to help you customize your builds.
|
||||
|
||||
Historically, Packer has used a JSON template for its configuration, but Packer
|
||||
is transitioning to a new template configuration format that uses HCL2 -- the
|
||||
same configuration language used by Terraform and HashiCorp's other products.
|
||||
This format is more flexible, more modular, and more concise than the original
|
||||
JSON template format. While the JSON format is still supported, certain
|
||||
new features in the Packer core will only be implemented for the newer HCL
|
||||
format. Please use the side bar to find documentation for the different
|
||||
template formats.
|
||||
## Template language
|
||||
|
||||
From version **1.7.0**, HCL2 becomes officially the preferred way to write Packer
|
||||
configuration(s).
|
||||
Packer supports templates written in [HCL2](/packer/docs/templates/hcl_templates) or [JSON](/packer/docs/templates/legacy_json_templates). Since v1.7.0, HCL2 is the official format for Packer configurations.
|
||||
|
||||
If you need help upgrading a JSON template to an HCL template, check
|
||||
our upgrade guide [here](/packer/tutorials/configuration-language/hcl2-upgrade).
|
||||
HCL2 is also the configuration language used in configurations for other HashiCorp products, such as Terraform. HCL is more flexible, modular, and concise than the JSON template format. Refer to [Upgrade Packer JSON template to HCL2](/packer/tutorials/configuration-language/hcl2-upgrade) for a tutorial on upgrading JSON templates to HCL templates.
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
~> **Note:** If possible, try to always use a forward slash `/` as the path separator,
|
||||
especially when dealing with relative paths. A backward slash `\` will work on
|
||||
Windows and is the official Windows path separator, but when building from any
|
||||
system that is not Windows, Packer will only treat slashes `/` as path
|
||||
separators, and treat backslashes as plain text. Which could lead to pathing
|
||||
errors.
|
||||
Separate paths with a forward slash (`/`), especially when using relative paths in your configuration.
|
||||
Windows uses backward slashes (`\`) to separate paths, but Packer only recognizes `/` as path
|
||||
separators when it creates builds from any non-Windows system. Packer also treat backslashes as plain text, which could lead to errors.
|
||||
|
||||
Loading…
Reference in new issue