Make template documentation visible from components docs (#10611)

This commit is contained in:
Sylvia Moss 2021-02-11 14:21:06 +01:00 committed by GitHub
parent 915372c73d
commit c5fca1f876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 13 deletions

View File

@ -13,5 +13,8 @@ for various platforms. For example, there are separate builders for EC2,
VMware, VirtualBox, etc. Packer comes with many builders by default, and can
also be extended to add new builders.
To learn more about an individual builder, choose it from the sidebar. Each
See the [`source`](/docs/templates/hcl_templates/blocks/source) block documentation to learn more
about configuring builders in the Packer language.
For information on an individual builder, choose it from the sidebar. Each
builder has its own configuration options and parameters.

View File

@ -11,4 +11,8 @@ sidebar_title: Data Sources
Data sources allow data to be fetched for use in Packer configuration. Use of data sources
allows a build to use information defined outside of Packer.
See the [`data`](/docs/templates/hcl_templates/datasources) block documentation to learn more
about working with data sources. For information on an individual data source,
choose it from the sidebar.
-> **Note:** Data sources is a feature exclusively to HCL2 templates included in Packer `v1.7.0`.

View File

@ -12,3 +12,7 @@ Post-processors run after the image is built by the builder and provisioned by
the provisioner(s). Post-processors are optional, and they can be used to
upload artifacts, re-package, or more. For more information about
post-processors, please choose an option from the sidebar.
See [`post-processor`](/docs/templates/hcl_templates/blocks/build/post-processor) and
[`post-processors`](/docs/templates/hcl_templates/blocks/build/post-processors)
blocks documentations to learn more about working with post-processors.

View File

@ -17,6 +17,6 @@ use cases for provisioners include:
- creating users
- downloading application code
See [Template Provisioners](/docs/templates/legacy_json_templates/provisioners) to learn more
See the [`provisioner`](/docs/templates/hcl_templates/blocks/build/provisioner) block documentation to learn more
about working with provisioners. For information on an individual provisioner,
choose it from the sidebar.

View File

@ -1,7 +1,7 @@
---
description: >
A source block nested in a build block allows you to use an already defined
source and to set specific fields which aren't already set in the top-level
source and to set specific fields which aren't already set in the top-level
source block.
page_title: source - build - Blocks
sidebar_title: <tt>source</tt>
@ -12,26 +12,29 @@ sidebar_title: <tt>source</tt>
`@include 'from-1.5/beta-hcl2-note.mdx'`
A `source` block nested in a `build` block allows you to use an already defined
source and to "fill in" those fields _which aren't already set in the top-level
source block_.
source and to "fill in" those fields _which aren't already set in the top-level
source block_.
Build-level source blocks are implemented by merging their contents with the
corresponding top-level source block, and a packer build will fail when it
encounters the ambiguity that arises when a source parameter is defined twice.
For example, in the below example, if the top-level "lxd.arch" source block
also defined an `output_image` field (or if one of the build-level source blocks
Build-level source blocks are implemented by merging their contents with the
corresponding top-level source block, and a packer build will fail when it
encounters the ambiguity that arises when a source parameter is defined twice.
For example, in the below example, if the top-level "lxd.arch" source block
also defined an `output_image` field (or if one of the build-level source blocks
redefined and image field), Packer would error.
```hcl
# builds.pkr.hcl
# file: builds.pkr.hcl
source "lxd" "arch" {
image = "archlinux"
}
build {
# Use the singular `source` block set specific fields.
# Note that fields cannot be overwritten, in other words, you cannot
# set the 'image' field from the top-level source block in here, as well as
# the 'name' and 'output_image' fields cannot be set in the top-level source block.
source "lxd.arch" {
// setting the name field allows to rename the source only for this build
// section.
# Setting the name field allows to rename the source only for this build section.
name = "nomad"
output_image = "nomad"
}

View File

@ -33,6 +33,8 @@ set specific source fields.
build {
source "source.amazon-ebs.example" {
# Here Packer will use the provided ami_name instead of defaulting it.
# Note that fields cannot be overwritten, in other words, you cannot
# set the 'ami_name' field in the top-level source block.
ami_name = "specific"
}
}