From c5fca1f876fa41e2068b74ca5ce156ffa6151036 Mon Sep 17 00:00:00 2001 From: Sylvia Moss Date: Thu, 11 Feb 2021 14:21:06 +0100 Subject: [PATCH] Make template documentation visible from components docs (#10611) --- website/content/docs/builders/index.mdx | 5 +++- website/content/docs/datasources/index.mdx | 4 +++ .../content/docs/post-processors/index.mdx | 4 +++ website/content/docs/provisioners/index.mdx | 2 +- .../hcl_templates/blocks/build/source.mdx | 25 +++++++++++-------- .../templates/hcl_templates/blocks/source.mdx | 2 ++ 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/website/content/docs/builders/index.mdx b/website/content/docs/builders/index.mdx index 385c540d5..b4af8bf51 100644 --- a/website/content/docs/builders/index.mdx +++ b/website/content/docs/builders/index.mdx @@ -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. + diff --git a/website/content/docs/datasources/index.mdx b/website/content/docs/datasources/index.mdx index 5a1570da9..542a3ef56 100644 --- a/website/content/docs/datasources/index.mdx +++ b/website/content/docs/datasources/index.mdx @@ -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`. diff --git a/website/content/docs/post-processors/index.mdx b/website/content/docs/post-processors/index.mdx index c90dab1d0..1e3a7c27b 100644 --- a/website/content/docs/post-processors/index.mdx +++ b/website/content/docs/post-processors/index.mdx @@ -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. diff --git a/website/content/docs/provisioners/index.mdx b/website/content/docs/provisioners/index.mdx index f054f2adc..8af276228 100644 --- a/website/content/docs/provisioners/index.mdx +++ b/website/content/docs/provisioners/index.mdx @@ -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. diff --git a/website/content/docs/templates/hcl_templates/blocks/build/source.mdx b/website/content/docs/templates/hcl_templates/blocks/build/source.mdx index 02b4b5e4d..b927e197e 100644 --- a/website/content/docs/templates/hcl_templates/blocks/build/source.mdx +++ b/website/content/docs/templates/hcl_templates/blocks/build/source.mdx @@ -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: source @@ -12,26 +12,29 @@ sidebar_title: source `@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" } diff --git a/website/content/docs/templates/hcl_templates/blocks/source.mdx b/website/content/docs/templates/hcl_templates/blocks/source.mdx index 1f91da94c..8a0d3bbd1 100644 --- a/website/content/docs/templates/hcl_templates/blocks/source.mdx +++ b/website/content/docs/templates/hcl_templates/blocks/source.mdx @@ -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" } }