Merge pull request #10486 from hashicorp/hcl_docs_refactor

HCL docs refactor
pull/10496/head
Megan Marsh 5 years ago committed by GitHub
commit 1f963687be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,7 +9,7 @@
[GH-10377]
* **New function** `env` allows users to set the default value of a variable to
the value of an environment variable. Please see [env function
docs](https://www.packer.io/docs/from-1.5/functions/contextual/env") for
docs](https://www.packer.io/docs/templates/hcl_templates/functions/contextual/env") for
more details. [GH-10240]
* **Future Scaffolding** This release contains a large number of no-op
refactoring changes. The Packer team at HashiCorp is preparing to split the

@ -153,7 +153,7 @@ type AlicloudImageConfig struct {
AlicloudImageTags map[string]string `mapstructure:"tags" required:"false"`
// Same as [`tags`](#tags) but defined as a singular repeatable block
// containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
AlicloudImageTag config.KeyValues `mapstructure:"tag" required:"false"`
AlicloudDiskDevices `mapstructure:",squash"`

@ -167,7 +167,7 @@ type Config struct {
RootVolumeTags map[string]string `mapstructure:"root_volume_tags" required:"false"`
// Same as [`root_volume_tags`](#root_volume_tags) but defined as a
// singular block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
RootVolumeTag config.KeyValues `mapstructure:"root_volume_tag" required:"false"`
// Whether or not to encrypt the volumes that are *launched*. By default, Packer will keep

@ -52,7 +52,7 @@ type AMIConfig struct {
AMITags map[string]string `mapstructure:"tags" required:"false"`
// Same as [`tags`](#tags) but defined as a singular repeatable block
// containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
AMITag config.KeyValues `mapstructure:"tag" required:"false"`
// Enable enhanced networking (ENA but not SriovNetSupport) on
@ -142,7 +142,7 @@ type AMIConfig struct {
SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false"`
// Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular
// repeatable block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
SnapshotTag config.KeyValues `mapstructure:"snapshot_tag" required:"false"`
// A list of account IDs that have

@ -204,7 +204,7 @@ type RunConfig struct {
RunTags map[string]string `mapstructure:"run_tags" required:"false"`
// Same as [`run_tags`](#run_tags) but defined as a singular repeatable
// block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
RunTag config.KeyValues `mapstructure:"run_tag" required:"false"`
// The ID (not the name) of the security
@ -319,7 +319,7 @@ type RunConfig struct {
SpotTags map[string]string `mapstructure:"spot_tags" required:"false"`
// Same as [`spot_tags`](#spot_tags) but defined as a singular repeatable block
// containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
SpotTag config.KeyValues `mapstructure:"spot_tag" required:"false"`
// Filters used to populate the `subnet_id` field.

@ -58,7 +58,7 @@ type Config struct {
VolumeRunTags map[string]string `mapstructure:"run_volume_tags"`
// Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular
// block containing a `name` and a `value` field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// [`dynamic_block`](https://packer.io/docs/templates/hcl_templates/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
VolumeRunTag config.NameValues `mapstructure:"run_volume_tag" required:"false"`
// Relevant only to Windows guests: If you set this flag, we'll add clauses

@ -64,7 +64,7 @@ type Config struct {
VolumeRunTags map[string]string `mapstructure:"run_volume_tags"`
// Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular
// block containing a `name` and a `value` field. In HCL2 mode the
// [`dynamic_block`](https://packer.io/docs/configuration/from-1.5/expressions.html#dynamic-blocks)
// [`dynamic_block`](https://packer.io/docs/templates/hcl_templates/expressions.html#dynamic-blocks)
// will allow you to create those programatically.
VolumeRunTag config.NameValues `mapstructure:"run_volume_tag" required:"false"`
// what architecture to use when registering the

@ -17,7 +17,7 @@ type BlockDevice struct {
Tags map[string]string `mapstructure:"tags" required:"false"`
// Same as [`tags`](#tags) but defined as a singular repeatable block
// containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
Tag config.KeyValues `mapstructure:"tag" required:"false"`
}

@ -70,7 +70,7 @@ type Config struct {
// Same as [`run_volume_tags`](#run_volume_tags) but defined as a singular
// repeatable block containing a `key` and a `value` field. In HCL2 mode
// the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
VolumeRunTag config.KeyValues `mapstructure:"run_volume_tag"`

@ -290,7 +290,7 @@ type Config struct {
AzureTags map[string]string `mapstructure:"azure_tags" required:"false"`
// Same as [`azure_tags`](#azure_tags) but defined as a singular repeatable block
// containing a `name` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
AzureTag config.NameValues `mapstructure:"azure_tag" required:"false"`
// Resource group under which the final artifact will be stored.

@ -64,7 +64,7 @@ type Config struct {
ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
// Same as [`image_tags`](#image_tags) but defined as a singular repeatable
// block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
ImageTag config.KeyValues `mapstructure:"image_tag" required:"false"`
// The service of the resulting image.
@ -77,7 +77,7 @@ type Config struct {
VmTags map[string]string `mapstructure:"vm_tags" required:"false"`
// Same as [`vm_tags`](#vm_tags) but defined as a singular repeatable block
// containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
VmTag config.NameValues `mapstructure:"vm_tag" required:"false"`
// The name of the created disk.

@ -89,7 +89,7 @@ type TencentCloudRunConfig struct {
RunTags map[string]string `mapstructure:"run_tags" required:"false"`
// Same as [`run_tags`](#run_tags) but defined as a singular repeatable
// block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
RunTag config.KeyValues `mapstructure:"run_tag" required:"false"`

@ -57,7 +57,7 @@ type SourceMachineConfig struct {
MachineTags map[string]string `mapstructure:"source_machine_tags" required:"false"`
// Same as [`source_machine_tags`](#source_machine_tags) but defined as a
// singular block containing a `key` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
MachineTag config.KeyValues `mapstructure:"source_machine_tag" required:"false"`
// Whether or not the firewall

@ -39,7 +39,7 @@ type TargetImageConfig struct {
ImageTags map[string]string `mapstructure:"image_tags" required:"false"`
// Same as [`image_tags`](#image_tags) but defined as a singular repeatable
// block containing a `name` and a `value` field. In HCL2 mode the
// [`dynamic_block`](/docs/configuration/from-1.5/expressions#dynamic-blocks)
// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
// will allow you to create those programatically.
ImageTag config.NameValues `mapstructure:"image_tag" required:"false"`
}

@ -72,23 +72,23 @@ const (
# All generated input variables will be of 'string' type as this is how Packer JSON
# views them; you can change their type later on. Read the variables type
# constraints documentation
# https://www.packer.io/docs/from-1.5/variables#type-constraints for more info.
# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints for more info.
`
packerBlockHeader = `
# See https://www.packer.io/docs/from-1.5/blocks/packer for more info
# See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for more info
`
sourcesHeader = `
# source blocks are generated from your builders; a source can be referenced in
# build blocks. A build block runs provisioner and post-processors on a
# source. Read the documentation for source blocks here:
# https://www.packer.io/docs/from-1.5/blocks/source`
# https://www.packer.io/docs/templates/hcl_templates/blocks/source`
buildHeader = `
# a build block invokes sources and runs provisioning steps on them. The
# documentation for build blocks can be found here:
# https://www.packer.io/docs/from-1.5/blocks/build
# https://www.packer.io/docs/templates/hcl_templates/blocks/build
build {
`
)
@ -343,44 +343,44 @@ func transposeTemplatingCalls(s []byte) []byte {
return "", UnhandleableArgumentError{
"lower",
"`lower(var.example)`",
"https://www.packer.io/docs/from-1.5/functions/string/lower",
"https://www.packer.io/docs/templates/hcl_templates/functions/string/lower",
}
},
"upper": func(_ string) (string, error) {
return "", UnhandleableArgumentError{
"upper",
"`upper(var.example)`",
"https://www.packer.io/docs/from-1.5/functions/string/upper",
"https://www.packer.io/docs/templates/hcl_templates/functions/string/upper",
}
},
"split": func(_, _ string, _ int) (string, error) {
return "", UnhandleableArgumentError{
"split",
"`split(separator, string)`",
"https://www.packer.io/docs/from-1.5/functions/string/split",
"https://www.packer.io/docs/templates/hcl_templates/functions/string/split",
}
},
"replace": func(_, _, _ string, _ int) (string, error) {
return "", UnhandleableArgumentError{
"replace",
"`replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`",
"https://www.packer.io/docs/from-1.5/functions/string/replace or https://www.packer.io/docs/from-1.5/functions/string/regex_replace",
"https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace",
}
},
"replace_all": func(_, _, _ string) (string, error) {
return "", UnhandleableArgumentError{
"replace_all",
"`replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`",
"https://www.packer.io/docs/from-1.5/functions/string/replace or https://www.packer.io/docs/from-1.5/functions/string/regex_replace",
"https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace",
}
},
"clean_resource_name": func(_ string) (string, error) {
return "", UnhandleableArgumentError{
"clean_resource_name",
"use custom validation rules, `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`",
"https://packer.io/docs/from-1.5/variables#custom-validation-rules" +
" , https://www.packer.io/docs/from-1.5/functions/string/replace" +
" or https://www.packer.io/docs/from-1.5/functions/string/regex_replace",
"https://packer.io/docs/templates/hcl_templates/variables#custom-validation-rules" +
" , https://www.packer.io/docs/templates/hcl_templates/functions/string/replace" +
" or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace",
}
},
"build_name": func() string {

@ -11,7 +11,7 @@
# and HCL2 calls (for example '${ var.string_value_example }' ). They won't be
# executed together and the outcome will be unknown.
# See https://www.packer.io/docs/from-1.5/blocks/packer for more info
# See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for more info
packer {
required_version = ">= 1.6.0"
}
@ -19,7 +19,7 @@ packer {
# All generated input variables will be of 'string' type as this is how Packer JSON
# views them; you can change their type later on. Read the variables type
# constraints documentation
# https://www.packer.io/docs/from-1.5/variables#type-constraints for more info.
# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints for more info.
variable "aws_access_key" {
type = string
default = ""
@ -53,7 +53,7 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
# source blocks are generated from your builders; a source can be referenced in
# build blocks. A build block runs provisioner and post-processors on a
# source. Read the documentation for source blocks here:
# https://www.packer.io/docs/from-1.5/blocks/source
# https://www.packer.io/docs/templates/hcl_templates/blocks/source
source "amazon-ebs" "autogenerated_1" {
access_key = "${var.aws_access_key}"
ami_description = "Ubuntu 16.04 LTS - expand root partition"
@ -92,7 +92,7 @@ source "amazon-ebs" "autogenerated_1" {
# a build block invokes sources and runs provisioning steps on them. The
# documentation for build blocks can be found here:
# https://www.packer.io/docs/from-1.5/blocks/build
# https://www.packer.io/docs/templates/hcl_templates/blocks/build
build {
sources = ["source.amazon-ebs.autogenerated_1"]
@ -105,7 +105,7 @@ build {
# template: hcl2_upgrade:2:38: executing "hcl2_upgrade" at <clean_resource_name>: error calling clean_resource_name: unhandled "clean_resource_name" call:
# there is no way to automatically upgrade the "clean_resource_name" call.
# Please manually upgrade to use custom validation rules, `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`
# Visit https://packer.io/docs/from-1.5/variables#custom-validation-rules , https://www.packer.io/docs/from-1.5/functions/string/replace or https://www.packer.io/docs/from-1.5/functions/string/regex_replace for more infos.
# Visit https://packer.io/docs/templates/hcl_templates/variables#custom-validation-rules , https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace for more infos.
provisioner "shell" {
inline = ["echo mybuild-{{isotime | clean_resource_name}}"]
}
@ -113,7 +113,7 @@ build {
# template: hcl2_upgrade:2:35: executing "hcl2_upgrade" at <lower>: error calling lower: unhandled "lower" call:
# there is no way to automatically upgrade the "lower" call.
# Please manually upgrade to `lower(var.example)`
# Visit https://www.packer.io/docs/from-1.5/functions/string/lower for more infos.
# Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/lower for more infos.
provisioner "shell" {
inline = ["echo {{ `SOMETHING` | lower }}"]
}
@ -121,7 +121,7 @@ build {
# template: hcl2_upgrade:2:35: executing "hcl2_upgrade" at <upper>: error calling upper: unhandled "upper" call:
# there is no way to automatically upgrade the "upper" call.
# Please manually upgrade to `upper(var.example)`
# Visit https://www.packer.io/docs/from-1.5/functions/string/upper for more infos.
# Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/upper for more infos.
provisioner "shell" {
inline = ["echo {{ `something` | upper }}"]
}
@ -129,7 +129,7 @@ build {
# template: hcl2_upgrade:2:21: executing "hcl2_upgrade" at <split `some-string` `-` 0>: error calling split: unhandled "split" call:
# there is no way to automatically upgrade the "split" call.
# Please manually upgrade to `split(separator, string)`
# Visit https://www.packer.io/docs/from-1.5/functions/string/split for more infos.
# Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/split for more infos.
provisioner "shell" {
inline = ["echo {{ split `some-string` `-` 0 }}"]
}
@ -137,7 +137,7 @@ build {
# template: hcl2_upgrade:2:21: executing "hcl2_upgrade" at <replace_all `-` `/` build_name>: error calling replace_all: unhandled "replace_all" call:
# there is no way to automatically upgrade the "replace_all" call.
# Please manually upgrade to `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`
# Visit https://www.packer.io/docs/from-1.5/functions/string/replace or https://www.packer.io/docs/from-1.5/functions/string/regex_replace for more infos.
# Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace for more infos.
provisioner "shell" {
inline = ["echo {{ replace_all `-` `/` build_name }}"]
}
@ -145,7 +145,7 @@ build {
# template: hcl2_upgrade:2:21: executing "hcl2_upgrade" at <replace `some-string` `-` `/` 1>: error calling replace: unhandled "replace" call:
# there is no way to automatically upgrade the "replace" call.
# Please manually upgrade to `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)`
# Visit https://www.packer.io/docs/from-1.5/functions/string/replace or https://www.packer.io/docs/from-1.5/functions/string/regex_replace for more infos.
# Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace for more infos.
provisioner "shell" {
inline = ["echo {{ replace `some-string` `-` `/` 1 }}"]
}

@ -156,7 +156,7 @@ func (v *Variable) Value() (cty.Value, hcl.Diagnostics) {
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Unset variable %q", v.Name),
Detail: "A used variable must be set or have a default value; see " +
"https://packer.io/docs/configuration/from-1.5/syntax for " +
"https://packer.io/docs/templates/hcl_templates/syntax for " +
"details.",
Context: v.Range.Ptr(),
}}

@ -59,7 +59,7 @@ func decodeVersionConstraint(attr *hcl.Attribute) (VersionConstraint, hcl.Diagno
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid version constraint",
Detail: "This string does not use correct version constraint syntax. Check out the docs: https://packer.io/docs/from-1.5/blocks/packer#version-constraints",
Detail: "This string does not use correct version constraint syntax. Check out the docs: https://packer.io/docs/templates/hcl_templates/blocks/packer#version-constraints",
Subject: attr.Expr.Range().Ptr(),
})
return ret, diags

@ -11,6 +11,15 @@
},
{
"pattern": "^https://github.com/hashicorp/packer-plugin-scaffolding"
},
{
"pattern": "^https://www.packer.io/docs/templates/hcl_templates/"
},
{
"pattern": "^https://packer.io/docs/templates/hcl_templates/"
},
{
"pattern": "^/docs/templates/hcl_templates/"
}
],
"replacementPatterns": [

@ -142,7 +142,7 @@ Here is a basic example. It is completely valid except for the access keys:
// set the environment variables to have the same name as the declared
// variables, with the prefix PKR_VAR_.
// There are other ways to [set variables](/docs/from-1.5/variables#assigning-values-to-build-variables), including from a var
// There are other ways to [set variables](/docs/templates/hcl_templates/variables#assigning-values-to-build-variables), including from a var
// file or as a command argument.
// export PKR_VAR_aws_access_key=$YOURKEY
@ -514,7 +514,7 @@ variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:

@ -158,7 +158,7 @@ run:
// set the environment variables to have the same name as the declared
// variables, with the prefix PKR_VAR_.
// There are other ways to [set variables](/docs/from-1.5/variables#assigning-values-to-build-variables)
// There are other ways to [set variables](/docs/templates/hcl_templates/variables#assigning-values-to-build-variables)
// including from a var file or as a command argument.
// export PKR_VAR_aws_access_key=$YOURKEY
@ -323,7 +323,7 @@ variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:

@ -227,7 +227,7 @@ variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:

@ -258,7 +258,7 @@ variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:
@ -281,7 +281,7 @@ marked for deletion on termination will remain in your account.
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:

@ -220,7 +220,7 @@ variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
This builder generates data that are shared with provisioner and post-processor via build function of [template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variables available for this builder are:

@ -217,7 +217,7 @@ You must specify (only) one of `commit`, `discard`, or `export_path`.
## Build Shared Information Variables
This build shares generated data with provisioners and post-processors via [template engines](/docs/templates/engine)
for JSON and [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
The generated variable available for this builder is:

@ -15,7 +15,7 @@ Type: `vsphere-clone`
This builder clones VMs from existing templates.
- VMware Player is not required.
- It uses the official vCenter API, and does not require ESXi host [modification](https://www.packer.io/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor)
- It uses the official vCenter API, and does not require ESXi host [modification](/docs/builders/vmware-iso.html#building-on-a-remote-vsphere-hypervisor)
- This builder is supported for vSphere version 6.5 and greater. Builds on lower
versions may work, but some configuration options may throw errors because they
do not exist in the older versions of the vSphere API.

@ -132,7 +132,7 @@ In configuration directives the following variables are available:
## Build Shared Information Variables
This builder generates data that are shared with provisioner and post-processor via build function of
[template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/from-1.5/contextual-variables)
[template engine](/docs/templates/engine) for JSON and [contextual variables](/docs/templates/hcl_templates/contextual-variables)
for HCL2.
The generated variables available for this builder see above

@ -117,7 +117,7 @@ $ echo {{timestamp}} | packer console
templating ( or `{{..}}` calls ) will not work in HCL2 mode.
Without a config file, `packer console` can be used to experiment with the
expression syntax and [built-in functions](/docs/from-1.5/functions).
expression syntax and [built-in functions](/docs/templates/hcl_templates/functions).
### Starting

@ -59,7 +59,7 @@ here is the list of calls that should get transformed:
- `` {{ user `my_var` }} `` becomes `${var.my_var}`.
- `` {{ env `my_var` }} `` becomes `${var.my_var}`. Packer HCL2 supports
environment variables through input variables. See
[docs](http://packer.io/docs/from-1.5/variables#environment-variables)
[docs](/docs/templates/hcl_templates/variables#environment-variables)
for more info.
- `{{ timestamp }}` becomes `${local.timestamp}`, the local variable
will be created for all generated files.

@ -33,7 +33,7 @@ The format of the configuration file is basic JSON.
## Configuration Reference
Below is the list of all available configuration parameters for the core
configuration file. None of these are required, since all have sane defaults.
configuration file. None of these are required, since all have defaults.
- `plugin_min_port` and `plugin_max_port` (number) - These are the minimum
and maximum ports that Packer uses for communication with plugins, since

@ -204,8 +204,8 @@ provide to procisioners (see below for more details on generatedData.)
Packer makes it possible to provide custom template engine variables to be
shared with provisioners and post-processors using the `build` function.
Json template `build` docs are [here](https://www.packer.io/docs/templates/engine#build)
and HCL template build docs are [here](https://www.packer.io/docs/from-1.5/contextual-variables#build-variables).
Json template `build` docs are [here](/docs/templates/engine#build)
and HCL template build docs are [here](/docs/templates/hcl_templates/contextual-variables#build-variables).
As of Packer v1.5.0, builder Prepare() methods return a list of custom variables
which we call `generated data`. We use that list of variables to generate a

@ -1,37 +0,0 @@
---
page_title: Blocks - Configuration Language
sidebar_title: Blocks
description: The HCL language has a number of blocks that can be used to configure builds.
---
# Built-in Blocks
`@include 'from-1.5/beta-hcl2-note.mdx'`
The Packer - HCL2 language includes a number of built-in blocks that you can
use. A block is a container for configuration.
Blocks can be defined in multiple files and `packer build folder` will build
using solely the files from a directory named `folder`.
Packer does not support user-defined blocks and so only the blocks built in to
the language are available for use. The navigation for this section includes a
list of all of the available built-in HCL2 blocks.
## Config example:
`@include 'from-1.5/variables/foo-block.mdx'`
- [Variable block documentation](/docs/from-1.5/blocks/variable).
`@include 'from-1.5/locals/example-block.mdx'`
- [Locals block documentation](/docs/from-1.5/blocks/locals).
`@include 'from-1.5/sources/example-block.mdx'`
- [source block documentation](/docs/from-1.5/blocks/source).
`@include 'from-1.5/builds/example-block.mdx'`
- [build block documentation](/docs/from-1.5/blocks/build).

@ -26,7 +26,7 @@ As such, the authentication credentials that built the image must have write
permissions to the GCS `paths`.
~> **Note**: By default the GCE image being exported will be deleted once the image has been exported.
To prevent Packer from deleting the image set the `keep_input_artifact` configuration option to `true`. See [Post-Processor Input Artifacts](https://www.packer.io/docs/templates/post-processors#input-artifacts) for more details.
To prevent Packer from deleting the image set the `keep_input_artifact` configuration option to `true`. See [Post-Processor Input Artifacts](/docs/templates/post-processors#input-artifacts) for more details.
## Configuration

@ -29,7 +29,7 @@ see the [GCE import documentation](https://cloud.google.com/compute/docs/images/
for details.
~> **Note**: To prevent Packer from deleting the compressed RAW disk image set the `keep_input_artifact` configuration option to `true`.
See [Post-Processor Input Artifacts](https://www.packer.io/docs/templates/post-processors#input-artifacts) for more details.
See [Post-Processor Input Artifacts](/docs/templates/post-processors#input-artifacts) for more details.
## Configuration

@ -26,7 +26,7 @@ If you've never used a post-processor before, please read the documentation on
This knowledge will be expected for the remainder of this document.
Because Vagrant boxes are
[provider-specific](https://docs.vagrantup.com/v2/boxes/format.html), the
[provider-specific](https://www.vagrantup.com/docs/boxes/format), the
Vagrant post-processor is hardcoded to understand how to convert the artifacts
of certain builders into proper boxes for their respective providers.
@ -102,7 +102,7 @@ more details about certain options in following sections.
- `vagrantfile_template` (string) - Path to a template to use for the
Vagrantfile that is packaged with the box. This option supports the usage of the [template engine](/docs/templates/engine)
for JSON and the [contextual variables](/docs/from-1.5/contextual-variables) for HCL2.
for JSON and the [contextual variables](/docs/templates/hcl_templates/contextual-variables) for HCL2.
- `vagrantfile_template_generated` (boolean) - By default, Packer will
exit with an error if the file specified using the

@ -16,12 +16,12 @@ To use builders in a `build` block you can either:
- Set the `sources` array of string with references to pre-defined sources.
- Define [build-level `source` blocks](/docs/from-1.5/blocks/build/source).
- Define [build-level `source` blocks](/docs/templates/hcl_templates/blocks/build/source).
This also allows you to set specific fields.
`@include 'from-1.5/builds/example-block.mdx'`
Define [top-level `source` blocks](/docs/from-1.5/blocks/source) to configure
Define [top-level `source` blocks](/docs/templates/hcl_templates/blocks/source) to configure
your builders. The list of available builders can be found in the
[builders](/docs/builders) section.

@ -32,7 +32,7 @@ can be found in the [post-processors](/docs/post-processors) section.
A `post-processor` can also take the `Artifact` from another post-processor
when it is defined in a [`post-processors`
block](/docs/from-1.5/blocks/build/post-processor) list, that is a list of
block](/docs/templates/hcl_templates/blocks/build/post-processor) list, that is a list of
chained post processors.
-> Note: The input 'artifact' received by a post-processor will be automatically
@ -84,11 +84,11 @@ The values within `only` or `except` are _source names_, not builder types.
Packer allows to access connection information and basic instance state
information from a post-processor. These information are stored in the `build`
variable. Check out the [Contextual
Variables](/docs/from-1.5/contextual-variables) documentation to learn more
Variables](/docs/templates/hcl_templates/contextual-variables) documentation to learn more
about and see some examples of how to use them.
### Related
- The [`post-processors` block](/docs/from-1.5/blocks/build/post-processor)
- The [`post-processors` block](/docs/templates/hcl_templates/blocks/build/post-processor)
allows to define one or more chain of `post-processor`s that will take the
output from the build and provision steps.

@ -11,7 +11,7 @@ sidebar_title: <tt>post-processors</tt>
`@include 'from-1.5/beta-hcl2-note.mdx'`
The `post-processors` block allows to define lists of
[`post-processor`s](/docs/from-1.5/blocks/build/post-processor), that will run
[`post-processor`s](/docs/templates/hcl_templates/blocks/build/post-processor), that will run
from the artifact of each build.
```hcl
@ -34,7 +34,7 @@ build {
}
```
The [`post-processor` block](/docs/from-1.5/blocks/build/post-processor)
The [`post-processor` block](/docs/templates/hcl_templates/blocks/build/post-processor)
allows to define multiple post-processors that will run from the `Artifact` of
each build. Read the `post-processor` documentation to know how to use a
post-processor.

@ -161,4 +161,4 @@ Timeout has no effect in debug mode.
## Build Contextual Variables
Packer allows to access connection information and basic instance state information from a provisioner. These information are stored in the `build` variable.
Check out the [Contextual Variables](/docs/from-1.5/contextual-variables) documentation to learn more about and see some examples of how to use them.
Check out the [Contextual Variables](/docs/templates/hcl_templates/contextual-variables) documentation to learn more about and see some examples of how to use them.

@ -0,0 +1,59 @@
---
page_title: Blocks - Configuration Language
sidebar_title: Blocks
description: The HCL language has a number of blocks that can be used to configure builds.
---
# Built-in Blocks
`@include 'from-1.5/beta-hcl2-note.mdx'`
The Packer - HCL2 language includes a number of built-in blocks that you can
use to configure builds. A block is a container for configuration.
The most important blocks can be broken into a couple of major types:
* `build` blocks contain configuration for a specific combination of builders,
provisioners, and post-processors used to create a specific image artifact.
* `source` blocks contain configuration for builder plugins. Once defined,
sources can be used and further configured by the "build" block.
* `provisioner` blocks contain configuration for provisioner plugins. These
blocks are nested inside of a build block.
* `post-processor` and `post-processors` blocks contain configuration for
post-processor plugins and post-processor plugin sequences. They are also
nested within `build` blocks.
* `variable` blocks contain configuration for variables that can either be
defaulted in configuration or set by the user at runtime.
* `locals` blocks contain configuration for variables that can be created using
HCL functions or data sources, or composited from variables created in the
variables blocks.
Use the sidebar to navigate to detailed documentation for each of these blocks.
Other blocks, such as the "packer" block, provide information to the Packer core
about what version it is allowed to run. The "required_plugins" block helps the
Packer core
Blocks can be defined in multiple files and `packer build folder` will build
using solely the files from a directory named `folder`.
Packer does not support user-defined blocks and so only the blocks built in to
the language are available for use. The navigation for this section includes a
list of all of the available built-in HCL2 blocks.
## Config example:
`@include 'from-1.5/variables/foo-block.mdx'`
- [Variable block documentation](/docs/templates/hcl_templates/blocks/variable).
`@include 'from-1.5/locals/example-block.mdx'`
- [Locals block documentation](/docs/templates/hcl_templates/blocks/locals).
`@include 'from-1.5/sources/example-block.mdx'`
- [source block documentation](/docs/templates/hcl_templates/blocks/source).
`@include 'from-1.5/builds/example-block.mdx'`
- [build block documentation](/docs/templates/hcl_templates/blocks/build).

@ -17,6 +17,6 @@ your Packer configuration.
# More on variables
- Read the [full locals](/docs/from-1.5/locals) description for a more
- Read the [full locals](/docs/templates/hcl_templates/locals) description for a more
thorough read.
- Read the [variables guide](/guides/hcl/variables) for more examples.

@ -62,7 +62,7 @@ other dependency management systems like Bundler and NPM.
required_version = ">= 1.2.0, < 2.0.0"
```
A version constraint is a [string literal](/docs/from-1.5/expressions#string-literals)
A version constraint is a [string literal](/docs/templates/hcl_templates/expressions#string-literals)
containing one or more conditions, which are separated by commas.
Each condition consists of an operator and a version number.

@ -14,7 +14,7 @@ The top-level `source` block defines reusable builder configuration blocks:
`@include 'from-1.5/sources/example-block.mdx'`
You can start builders by refering to those source blocks form a [`build`
block](/docs/from-1.5/blocks/build), for example :
block](/docs/templates/hcl_templates/blocks/build), for example :
```hcl
build {
@ -26,7 +26,7 @@ build {
}
```
The build-level [`source` block](/docs/from-1.5/blocks/build/source) allows to
The build-level [`source` block](/docs/templates/hcl_templates/blocks/build/source) allows to
set specific source fields.
```hcl

@ -12,7 +12,7 @@ sidebar_title: <tt>variable</tt>
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](/docs/from-1.5/blocks/locals) for that instead.
input variable: we recommend using [locals](/docs/templates/hcl_templates/blocks/locals) for that instead.
`@include 'from-1.5/variables/foo-block.mdx'`
@ -35,6 +35,6 @@ Example of a variable assignment from a file:
# More on variables
- Read the [full variables](/docs/from-1.5/variables) description for a more
- Read the [full variables](/docs/templates/hcl_templates/variables) description for a more
thorough read.
- Read the [variables guide](/guides/hcl/variables) for more examples.

@ -67,8 +67,8 @@ Here is the list of available build variables:
For backwards compatibility, `WinRMPassword` is also available through this
engine, though it is no different than using the more general `Password`.
All build variables are valid to use with any of the [HCL2 functions](/docs/from-1.5/functions).
Example of using [upper](/docs/from-1.5/functions/string/upper) to upper case the build ID:
All build variables are valid to use with any of the [HCL2 functions](/docs/templates/hcl_templates/functions).
Example of using [upper](/docs/templates/hcl_templates/functions/string/upper) to upper case the build ID:
```hcl
post-processor "shell-local" {

@ -124,7 +124,7 @@ types described above:
Key/value pairs can be separated by either a comma or a line break. Values
can be arbitrary expressions. Keys are strings; they can be left unquoted if
they are a valid [identifier](/docs/from-1.5/syntax#identifiers), but must be quoted
they are a valid [identifier](/docs/templates/hcl_templates/syntax#identifiers), but must be quoted
otherwise. You can use a non-literal expression as a key by wrapping it in
parentheses, like `(var.business_unit_tag_name) = "SRE"`.
@ -135,13 +135,13 @@ Packer makes one named values available.
The following named values are available:
- `source.<SOURCE TYPE>.<NAME>` is an object representing a
[source](/docs/from-1.5/blocks/source) of the given type
[source](/docs/templates/hcl_templates/blocks/source) of the given type
and name.
### Available Functions
For a full list of available functions, see [the function
reference](/docs/configuration/from-1.5/functions).
reference](/docs/templates/hcl_templates/functions).
## `for` Expressions
@ -336,8 +336,8 @@ block. If you need to declare resource instances based on a nested data
structure or combinations of elements from multiple data structures you can use
expressions and functions to derive a suitable value. For some common examples
of such situations, see the
[`flatten`](/docs/configuration/from-1.5/functions/collection/flatten) and
[`setproduct`](/docs/configuration/from-1.5/functions/collection/setproduct)
[`flatten`](/docs/templates/hcl_templates/functions/collection/flatten) and
[`setproduct`](/docs/templates/hcl_templates/functions/collection/setproduct)
functions.
### Best Practices for `dynamic` Blocks

@ -32,5 +32,5 @@ b
## Related Functions
- [`coalescelist`](/docs/from-1.5/functions/collection/coalescelist) performs a similar operation with
- [`coalescelist`](/docs/templates/hcl_templates/functions/collection/coalescelist) performs a similar operation with
list arguments rather than individual arguments.

@ -39,5 +39,5 @@ symbol to expand the outer list as arguments:
## Related Functions
- [`coalesce`](/docs/from-1.5/functions/collection/coalesce) performs a similar operation with string
- [`coalesce`](/docs/templates/hcl_templates/functions/collection/coalesce) performs a similar operation with string
arguments rather than list arguments.

@ -35,5 +35,5 @@ a
## Related Functions
- [`index`](/docs/from-1.5/functions/collection/index-fn) finds the index for a particular element value.
- [`lookup`](/docs/from-1.5/functions/collection/lookup) retrieves a value from a _map_ given its _key_.
- [`index`](/docs/templates/hcl_templates/functions/collection/index-fn) finds the index for a particular element value.
- [`lookup`](/docs/templates/hcl_templates/functions/collection/lookup) retrieves a value from a _map_ given its _key_.

@ -31,7 +31,7 @@ Indirectly-nested lists, such as those in maps, are _not_ flattened.
The
[resource `for_each`](https://www.terraform.io/docs/configuration/resources.html#for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings)
and
[`dynamic` block](/docs/from-1.5/expressions#dynamic-blocks)
[`dynamic` block](/docs/templates/hcl_templates/expressions#dynamic-blocks)
language features both require a collection value that has one element for
each repetition.
@ -104,6 +104,6 @@ the associations between the subnets and their containing networks.
## Related Functions
- [`setproduct`](/docs/from-1.5/functions/collection/setproduct) finds all of the combinations of multiple
- [`setproduct`](/docs/templates/hcl_templates/functions/collection/setproduct) finds all of the combinations of multiple
lists or sets of values, which can also be useful when preparing collections
for use with `for_each` constructs.

@ -24,5 +24,5 @@ value is not present in the list.
## Related Functions
- [`element`](/docs/from-1.5/functions/collection/element) retrieves a particular element from a list given
- [`element`](/docs/templates/hcl_templates/functions/collection/element) retrieves a particular element from a list given
its index.

@ -24,4 +24,4 @@ be identical as long as the keys in the map don't change.
## Related Functions
- [`values`](/docs/from-1.5/functions/collection/values) returns a list of the _values_ from a map.
- [`values`](/docs/templates/hcl_templates/functions/collection/values) returns a list of the _values_ from a map.

@ -28,4 +28,4 @@ what?
## Related Functions
- [`element`](/docs/from-1.5/functions/collection/element) retrieves a value from a _list_ given its _index_.
- [`element`](/docs/templates/hcl_templates/functions/collection/element) retrieves a value from a _list_ given its _index_.

@ -22,4 +22,4 @@ with all of the same elements as the given sequence but in reverse order.
## Related Functions
- [`strrev`](/docs/from-1.5/functions/string/strrev) reverses a string.
- [`strrev`](/docs/templates/hcl_templates/functions/string/strrev) reverses a string.

@ -31,9 +31,9 @@ the ordering of the given elements is not preserved.
## Related Functions
- [`contains`](/docs/from-1.5/functions/collection/contains) tests whether a given list or set contains
- [`contains`](/docs/templates/hcl_templates/functions/collection/contains) tests whether a given list or set contains
a given element value.
- [`setproduct`](/docs/from-1.5/functions/collection/setproduct) computes the _Cartesian product_ of multiple
- [`setproduct`](/docs/templates/hcl_templates/functions/collection/setproduct) computes the _Cartesian product_ of multiple
sets.
- [`setunion`](/docs/from-1.5/functions/collection/setunion) computes the _union_ of
- [`setunion`](/docs/templates/hcl_templates/functions/collection/setunion) computes the _union_ of
multiple sets.

@ -118,7 +118,7 @@ elements all have a consistent type:
The
[resource `for_each`](https://www.terraform.io/docs/configuration/resources.html#for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings)
and
[`dynamic` block](/docs/from-1.5/expressions/#dynamic-blocks)
[`dynamic` block](/docs/templates/hcl_templates/expressions/#dynamic-blocks)
language features both require a collection value that has one element for
each repetition.
@ -212,12 +212,12 @@ elements in the input variables.
## Related Functions
- [`contains`](/docs/from-1.5/functions/collection/contains) tests whether a given list or set contains
- [`contains`](/docs/templates/hcl_templates/functions/collection/contains) tests whether a given list or set contains
a given element value.
- [`flatten`](/docs/from-1.5/functions/collection/flatten) is useful for flattening heirarchical data
- [`flatten`](/docs/templates/hcl_templates/functions/collection/flatten) is useful for flattening heirarchical data
into a single list, for situations where the relationships between two
object types are defined explicitly.
- [`setintersection`](/docs/from-1.5/functions/collection/setintersection) computes the _intersection_ of
- [`setintersection`](/docs/templates/hcl_templates/functions/collection/setintersection) computes the _intersection_ of
multiple sets.
- [`setunion`](/docs/from-1.5/functions/collection/setunion) computes the _union_ of multiple
- [`setunion`](/docs/templates/hcl_templates/functions/collection/setunion) computes the _union_ of multiple
sets.

@ -34,9 +34,9 @@ the ordering of the given elements is not preserved.
## Related Functions
- [`contains`](/docs/from-1.5/functions/collection/contains) tests whether a given list or set contains
- [`contains`](/docs/templates/hcl_templates/functions/collection/contains) tests whether a given list or set contains
a given element value.
- [`setintersection`](/docs/from-1.5/functions/collection/setintersection) computes the _intersection_ of
- [`setintersection`](/docs/templates/hcl_templates/functions/collection/setintersection) computes the _intersection_ of
multiple sets.
- [`setproduct`](/docs/from-1.5/functions/collection/setproduct) computes the _Cartesian product_ of multiple
- [`setproduct`](/docs/templates/hcl_templates/functions/collection/setproduct) computes the _Cartesian product_ of multiple
sets.

@ -28,5 +28,5 @@ list.
## Related Functions
- [`substr`](/docs/from-1.5/functions/string/substr) performs a similar function for characters in a
- [`substr`](/docs/templates/hcl_templates/functions/string/substr) performs a similar function for characters in a
string, although it uses a length instead of an end index.

@ -11,7 +11,7 @@ in that map.
The values are returned in lexicographical order by their corresponding _keys_,
so the values will be returned in the same order as their keys would be
returned from [`keys`](/docs/from-1.5/functions/collection/keys).
returned from [`keys`](/docs/templates/hcl_templates/functions/collection/keys).
## Examples
@ -26,4 +26,4 @@ returned from [`keys`](/docs/from-1.5/functions/collection/keys).
## Related Functions
- [`keys`](/docs/from-1.5/functions/collection/keys) returns a list of the _keys_ from a map.
- [`keys`](/docs/templates/hcl_templates/functions/collection/keys) returns a list of the _keys_ from a map.

@ -19,7 +19,7 @@ other places.
In the previous example, the value of `aws_region` will be what's stored in the
`AWS_DEFAULT_REGION` env var, unless aws_region is also set in a [manner that takes
precedence](/docs/from-1.5/variables#variable-definition-precedence).
precedence](/docs/templates/hcl_templates/variables#variable-definition-precedence).
-> **Why can't I use environment variables elsewhere?** User variables are the
single source of configurable input. We felt that having environment variables
@ -31,7 +31,7 @@ template that a user can easily discover using `packer inspect`.
When the environment variable is not set at all -- not even with the empty
string -- the value returned by `env` will be an an empty string. It will still
be possible to set it using other means but you could use [custom validation
rules](/docs/from-1.5/variables#custom-validation-rules) to error in that case
rules](/docs/templates/hcl_templates/variables#custom-validation-rules) to error in that case
to make sure it is set, for example:
```hcl

@ -13,7 +13,7 @@ whether the expression produced a result without any errors.
This is a special function that is able to catch errors produced when evaluating
its argument. For most situations where you could use `can` it's better to use
[`try`](/docs/from-1.5/functions/conversion/try) instead, because it allows for more concise definition of
[`try`](/docs/templates/hcl_templates/functions/conversion/try) instead, because it allows for more concise definition of
fallback values for failing expressions.
The `can` function can only catch and handle _dynamic_ errors resulting from
@ -25,7 +25,7 @@ as a malformed resource reference.
variable validation rules. Although it can technically accept any sort of
expression and be used elsewhere in the configuration, we recommend against
using it in other contexts. For error handling elsewhere in the configuration,
prefer to use [`try`](/docs/from-1.5/functions/conversion/try).
prefer to use [`try`](/docs/templates/hcl_templates/functions/conversion/try).
## Examples
@ -54,5 +54,5 @@ A local value with the name "nonexist" has not been declared.
## Related Functions
- [`try`](/docs/from-1.5/functions/conversion/try), which tries evaluating a sequence of expressions and
- [`try`](/docs/templates/hcl_templates/functions/conversion/try), which tries evaluating a sequence of expressions and
returns the result of the first one that succeeds.

@ -108,5 +108,5 @@ A local value with the name "nonexist" has not been declared.
## Related Functions
- [`can`](/docs/from-1.5/functions/conversion/can), which tries evaluating an expression and returns a
- [`can`](/docs/templates/hcl_templates/functions/conversion/can), which tries evaluating an expression and returns a
boolean value indicating whether it succeeded.

@ -100,7 +100,7 @@ configuration as needed:
## Related Functions
- [`format`](/docs/from-1.5/functions/string/format) is a more general formatting function for arbitrary
- [`format`](/docs/templates/hcl_templates/functions/string/format) is a more general formatting function for arbitrary
data.
- [`timestamp`](/docs/from-1.5/functions/datetime/timestamp) returns the current date and time in a format
- [`timestamp`](/docs/templates/hcl_templates/functions/datetime/timestamp) returns the current date and time in a format
suitable for input to `formatdate`.

@ -30,7 +30,7 @@ of adding the given direction to the given timestamp.
-> **Breaking change note:** Packer previously let you decide your own "Date
and Time format" syntax. With HCL2 and for parity with Terraform, Packer will
be using the [RFC 3339](https://tools.ietf.org/html/rfc3339) "Date and Time
format" syntax. As a string. [`formatdate`](/docs/from-1.5/functions/datetime/formatdate) still allows you
format" syntax. As a string. [`formatdate`](/docs/templates/hcl_templates/functions/datetime/formatdate) still allows you
to format a date.
## Examples

@ -22,7 +22,7 @@ Packer run.
-> **Breaking change note:** Packer previously let you decide your own "Date
and Time format" syntax. With HCL2 and for parity with Terraform, Packer will
be using the [RFC 3339](https://tools.ietf.org/html/rfc3339) "Date and Time
format" syntax. As a string. [`formatdate`](/docs/from-1.5/functions/datetime/formatdate) still allows you
format" syntax. As a string. [`formatdate`](/docs/templates/hcl_templates/functions/datetime/formatdate) still allows you
to format a date.
## Examples
@ -34,5 +34,5 @@ to format a date.
## Related Functions
- [`formatdate`](/docs/from-1.5/functions/datetime/formatdate) can convert the resulting timestamp to
- [`formatdate`](/docs/templates/hcl_templates/functions/datetime/formatdate) can convert the resulting timestamp to
other date and time formats.

@ -33,5 +33,5 @@ Hello World
## Related Functions
- [`base64encode`](/docs/from-1.5/functions/encoding/base64encode) performs the opposite operation,
- [`base64encode`](/docs/templates/hcl_templates/functions/encoding/base64encode) performs the opposite operation,
encoding the UTF-8 bytes for a string as Base64.

@ -34,5 +34,5 @@ SGVsbG8gV29ybGQ=
## Related Functions
- [`base64decode`](/docs/from-1.5/functions/encoding/base64decode) performs the opposite operation,
- [`base64decode`](/docs/templates/hcl_templates/functions/encoding/base64decode) performs the opposite operation,
decoding Base64 data and interpreting it as a UTF-8 string.

@ -14,7 +14,7 @@ of the result of decoding that string.
The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159).
This function maps JSON values to
[Packer language values](/docs/from-1.5/expressions#types-and-values)
[Packer language values](/docs/templates/hcl_templates/expressions#types-and-values)
in the following way:
| JSON type | Packer type |
@ -43,5 +43,5 @@ true
## Related Functions
- [`jsonencode`](/docs/from-1.5/functions/encoding/jsonencode) performs the opposite operation, _encoding_
- [`jsonencode`](/docs/templates/hcl_templates/functions/encoding/jsonencode) performs the opposite operation, _encoding_
a value as JSON.

@ -11,7 +11,7 @@ description: The jsonencode function encodes a given value as a JSON string.
The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159).
This function maps
[Packer language values](/docs/from-1.5/expressions#types-and-values)
[Packer language values](/docs/templates/hcl_templates/expressions#types-and-values)
to JSON values in the following way:
| Packer type | JSON type |
@ -40,5 +40,5 @@ rarely a problem in practice.
## Related Functions
- [`jsondecode`](/docs/from-1.5/functions/encoding/jsondecode) performs the opposite operation, _decoding_
- [`jsondecode`](/docs/templates/hcl_templates/functions/encoding/jsondecode) performs the opposite operation, _decoding_
a JSON string to obtain its represented value.

@ -15,7 +15,7 @@ This function supports a subset of [YAML 1.2](https://yaml.org/spec/1.2/spec.htm
as described below.
This function maps YAML values to
[Packer language values](/docs/from-1.5/expressions#types-and-values)
[Packer language values](/docs/templates/hcl_templates/expressions#types-and-values)
in the following way:
| YAML type | Packer type |
@ -94,7 +94,7 @@ Call to function "yamldecode" failed: unsupported tag "!not-supported".
## Related Functions
- [`jsondecode`](/docs/from-1.5/functions/encoding/jsondecode) is a similar operation using JSON instead
- [`jsondecode`](/docs/templates/hcl_templates/functions/encoding/jsondecode) is a similar operation using JSON instead
of YAML.
- [`yamlencode`](/docs/from-1.5/functions/encoding/yamlencode) performs the opposite operation, _encoding_
- [`yamlencode`](/docs/templates/hcl_templates/functions/encoding/yamlencode) performs the opposite operation, _encoding_
a value as YAML.

@ -13,7 +13,7 @@ description: The yamlencode function encodes a given value as a YAML string.
result format may change in future versions of Packer, based on feedback.
Do not use `yamldecode` to construct a value for any resource argument where
changes to the result would be disruptive. To get a consistent string
representation of a value use [`jsonencode`](/docs/from-1.5/functions/encoding/jsonencode) instead; its
representation of a value use [`jsonencode`](/docs/templates/hcl_templates/functions/encoding/jsonencode) instead; its
results are also valid YAML because YAML is a JSON superset.
<!--
@ -27,7 +27,7 @@ results are also valid YAML because YAML is a JSON superset.
-->
This function maps
[Packer language values](/docs/from-1.5/expressions#types-and-values)
[Packer language values](/docs/templates/hcl_templates/expressions#types-and-values)
to YAML tags in the following way:
| Packer type | YAML type |
@ -75,12 +75,12 @@ mean that this is rarely a problem in practice.
`yamlencode` always uses YAML's "block style" for mappings and sequences, unless
the mapping or sequence is empty. To generate flow-style YAML, use
[`jsonencode`](/docs/from-1.5/functions/encoding/jsonencode) instead: YAML flow-style is a superset
[`jsonencode`](/docs/templates/hcl_templates/functions/encoding/jsonencode) instead: YAML flow-style is a superset
of JSON syntax.
## Related Functions
- [`jsonencode`](/docs/from-1.5/functions/encoding/jsonencode) is a similar operation using JSON instead
- [`jsonencode`](/docs/templates/hcl_templates/functions/encoding/jsonencode) is a similar operation using JSON instead
of YAML.
- [`yamldecode`](/docs/from-1.5/functions/encoding/yamldecode) performs the opposite operation, _decoding_
- [`yamldecode`](/docs/templates/hcl_templates/functions/encoding/yamldecode) performs the opposite operation, _decoding_
a YAML string to obtain its represented value.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save