Update docs to clarify how to use build vars in build template engines (#10141)

This commit is contained in:
Megan Marsh 2020-10-22 00:42:45 -07:00 committed by GitHub
parent ee4b3e796e
commit edca188175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 0 deletions

View File

@ -557,6 +557,22 @@ Usage example:
<Tab heading="HCL2"> <Tab heading="HCL2">
```hcl ```hcl
// When accessing one of these variables from inside the builder, you need to
// use the golang templating syntax. This is due to an architectural quirk that
// won't be easily resolvable until legacy json templates are deprecated:
{
source "amazon-ebs" "basic-example" {
tags = {
OS_Version = "Ubuntu"
Release = "Latest"
Base_AMI_ID = "{{ .SourceAMI }}"
Base_AMI_Name = "{{ .SourceAMIName }}"
}
}
// when accessing one of the variables from a provisioner or post-processor, use
// hcl-syntax
post-processor "manifest" { post-processor "manifest" {
output = "manifest.json" output = "manifest.json"
strip_path = true strip_path = true

View File

@ -361,6 +361,22 @@ Usage example:
<Tab heading="HCL2"> <Tab heading="HCL2">
```hcl ```hcl
// When accessing one of these variables from inside the builder, you need to
// use the golang templating syntax. This is due to an architectural quirk that
// won't be easily resolvable until legacy json templates are deprecated:
{
source "amazon-ebs" "basic-example" {
tags = {
OS_Version = "Ubuntu"
Release = "Latest"
Base_AMI_ID = "{{ .SourceAMI }}"
Base_AMI_Name = "{{ .SourceAMIName }}"
}
}
// when accessing one of the variables from a provisioner or post-processor, use
// hcl-syntax
post-processor "manifest" { post-processor "manifest" {
output = "manifest.json" output = "manifest.json"
strip_path = true strip_path = true

View File

@ -265,6 +265,22 @@ Usage example:
<Tab heading="HCL2"> <Tab heading="HCL2">
```hcl ```hcl
// When accessing one of these variables from inside the builder, you need to
// use the golang templating syntax. This is due to an architectural quirk that
// won't be easily resolvable until legacy json templates are deprecated:
{
source "amazon-ebs" "basic-example" {
tags = {
OS_Version = "Ubuntu"
Release = "Latest"
Base_AMI_ID = "{{ .SourceAMI }}"
Base_AMI_Name = "{{ .SourceAMIName }}"
}
}
// when accessing one of the variables from a provisioner or post-processor, use
// hcl-syntax
post-processor "manifest" { post-processor "manifest" {
output = "manifest.json" output = "manifest.json"
strip_path = true strip_path = true

View File

@ -312,6 +312,22 @@ Usage example:
<Tab heading="HCL2"> <Tab heading="HCL2">
```hcl ```hcl
// When accessing one of these variables from inside the builder, you need to
// use the golang templating syntax. This is due to an architectural quirk that
// won't be easily resolvable until legacy json templates are deprecated:
{
source "amazon-ebs" "basic-example" {
tags = {
OS_Version = "Ubuntu"
Release = "Latest"
Base_AMI_ID = "{{ .SourceAMI }}"
Base_AMI_Name = "{{ .SourceAMIName }}"
}
}
// when accessing one of the variables from a provisioner or post-processor, use
// hcl-syntax
post-processor "manifest" { post-processor "manifest" {
output = "manifest.json" output = "manifest.json"
strip_path = true strip_path = true

View File

@ -258,6 +258,22 @@ Usage example:
<Tab heading="HCL2"> <Tab heading="HCL2">
```hcl ```hcl
// When accessing one of these variables from inside the builder, you need to
// use the golang templating syntax. This is due to an architectural quirk that
// won't be easily resolvable until legacy json templates are deprecated:
{
source "amazon-ebs" "basic-example" {
tags = {
OS_Version = "Ubuntu"
Release = "Latest"
Base_AMI_ID = "{{ .SourceAMI }}"
Base_AMI_Name = "{{ .SourceAMIName }}"
}
}
// when accessing one of the variables from a provisioner or post-processor, use
// hcl-syntax
post-processor "manifest" { post-processor "manifest" {
output = "manifest.json" output = "manifest.json"
strip_path = true strip_path = true