2019-12-17 05:25:56 -05:00
|
|
|
package hcl2template
|
|
|
|
|
|
|
|
import (
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
"path/filepath"
|
2019-12-17 05:25:56 -05:00
|
|
|
"testing"
|
|
|
|
|
2020-06-05 05:51:23 -04:00
|
|
|
. "github.com/hashicorp/packer/hcl2template/internal"
|
2019-12-17 05:25:56 -05:00
|
|
|
"github.com/hashicorp/packer/packer"
|
2020-12-09 06:39:54 -05:00
|
|
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
2019-12-17 05:25:56 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestParse_build(t *testing.T) {
|
|
|
|
defaultParser := getBasicParser()
|
|
|
|
|
|
|
|
tests := []parseTest{
|
|
|
|
{"basic build no src",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/basic.pkr.hcl", nil, nil},
|
2019-12-17 05:25:56 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
2019-12-17 05:25:56 -05:00
|
|
|
Builds: Builds{
|
|
|
|
&BuildBlock{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Sources: []SourceRef{
|
2019-12-17 05:25:56 -05:00
|
|
|
{
|
|
|
|
Type: "amazon-ebs",
|
|
|
|
Name: "ubuntu-1604",
|
|
|
|
},
|
2020-01-06 10:05:30 -05:00
|
|
|
refVBIsoUbuntu1204,
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
ProvisionerBlocks: []*ProvisionerBlock{
|
|
|
|
{
|
|
|
|
PType: "shell",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PType: "file",
|
|
|
|
},
|
|
|
|
},
|
2020-07-28 04:02:37 -04:00
|
|
|
PostProcessorsLists: [][]*PostProcessorBlock{
|
2019-12-17 05:25:56 -05:00
|
|
|
{
|
2020-07-28 04:02:37 -04:00
|
|
|
{
|
|
|
|
PType: "amazon-import",
|
|
|
|
},
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false, false,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{},
|
2019-12-17 05:25:56 -05:00
|
|
|
true,
|
|
|
|
},
|
|
|
|
{"untyped provisioner",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/provisioner_untyped.pkr.hcl", nil, nil},
|
2019-12-17 05:25:56 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: nil,
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
true, true,
|
|
|
|
nil,
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{"inexistent provisioner",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/provisioner_inexistent.pkr.hcl", nil, nil},
|
2019-12-17 05:25:56 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: nil,
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
true, true,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{&packer.CoreBuild{}},
|
2019-12-17 05:25:56 -05:00
|
|
|
false,
|
|
|
|
},
|
|
|
|
{"untyped post-processor",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/post-processor_untyped.pkr.hcl", nil, nil},
|
2019-12-17 05:25:56 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: nil,
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
true, true,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{&packer.CoreBuild{}},
|
2019-12-17 05:25:56 -05:00
|
|
|
false,
|
|
|
|
},
|
|
|
|
{"inexistent post-processor",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/post-processor_inexistent.pkr.hcl", nil, nil},
|
2019-12-17 05:25:56 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: nil,
|
2019-12-17 05:25:56 -05:00
|
|
|
},
|
|
|
|
true, true,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{},
|
2019-12-17 05:25:56 -05:00
|
|
|
false,
|
|
|
|
},
|
2020-01-06 08:29:43 -05:00
|
|
|
{"invalid source",
|
|
|
|
defaultParser,
|
2020-03-12 09:27:56 -04:00
|
|
|
parseTestArgs{"testdata/build/invalid_source_reference.pkr.hcl", nil, nil},
|
2020-01-06 08:29:43 -05:00
|
|
|
&PackerConfig{
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: nil,
|
2020-01-06 08:29:43 -05:00
|
|
|
},
|
|
|
|
true, true,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{},
|
2020-01-06 08:29:43 -05:00
|
|
|
false,
|
|
|
|
},
|
2020-05-18 02:27:06 -04:00
|
|
|
{"named build",
|
|
|
|
defaultParser,
|
|
|
|
parseTestArgs{"testdata/build/named.pkr.hcl", nil, nil},
|
|
|
|
&PackerConfig{
|
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Builds: Builds{
|
|
|
|
&BuildBlock{
|
|
|
|
Name: "somebuild",
|
|
|
|
Sources: []SourceRef{
|
|
|
|
{
|
|
|
|
Type: "amazon-ebs",
|
|
|
|
Name: "ubuntu-1604",
|
|
|
|
},
|
|
|
|
refVBIsoUbuntu1204,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false, false,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{},
|
2020-05-18 02:27:06 -04:00
|
|
|
true,
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
{"post-processor with only and except",
|
|
|
|
defaultParser,
|
|
|
|
parseTestArgs{"testdata/build/post-processor_onlyexcept.pkr.hcl", nil, nil},
|
|
|
|
&PackerConfig{
|
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Sources: map[SourceRef]SourceBlock{
|
|
|
|
refVBIsoUbuntu1204: {Type: "virtualbox-iso", Name: "ubuntu-1204"},
|
|
|
|
refAWSEBSUbuntu1604: {Type: "amazon-ebs", Name: "ubuntu-1604"},
|
|
|
|
},
|
|
|
|
Builds: Builds{
|
|
|
|
&BuildBlock{
|
2020-07-02 05:07:59 -04:00
|
|
|
Sources: []SourceRef{
|
|
|
|
refVBIsoUbuntu1204,
|
|
|
|
SourceRef{Type: "amazon-ebs", Name: "ubuntu-1604", LocalName: "aws-ubuntu-16.04"},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
ProvisionerBlocks: nil,
|
2020-07-28 04:02:37 -04:00
|
|
|
PostProcessorsLists: [][]*PostProcessorBlock{
|
2020-06-05 05:51:23 -04:00
|
|
|
{
|
2020-07-28 04:02:37 -04:00
|
|
|
{
|
|
|
|
PType: "amazon-import",
|
|
|
|
OnlyExcept: OnlyExcept{Only: []string{"virtualbox-iso.ubuntu-1204"}, Except: nil},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
{
|
2020-07-28 04:02:37 -04:00
|
|
|
{
|
|
|
|
PType: "manifest",
|
|
|
|
OnlyExcept: OnlyExcept{Only: nil, Except: []string{"virtualbox-iso.ubuntu-1204"}},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
{
|
2020-07-28 04:02:37 -04:00
|
|
|
{
|
|
|
|
PType: "amazon-import",
|
|
|
|
OnlyExcept: OnlyExcept{Only: []string{"amazon-ebs.aws-ubuntu-16.04"}, Except: nil},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
|
|
|
{
|
2020-07-28 04:02:37 -04:00
|
|
|
{
|
|
|
|
PType: "manifest",
|
|
|
|
OnlyExcept: OnlyExcept{Only: nil, Except: []string{"amazon-ebs.aws-ubuntu-16.04"}},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false, false,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{
|
2020-06-05 05:51:23 -04:00
|
|
|
&packer.CoreBuild{
|
|
|
|
Type: "virtualbox-iso.ubuntu-1204",
|
|
|
|
Prepared: true,
|
|
|
|
Builder: emptyMockBuilder,
|
|
|
|
Provisioners: []packer.CoreBuildProvisioner{},
|
|
|
|
PostProcessors: [][]packer.CoreBuildPostProcessor{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PType: "amazon-import",
|
2020-07-06 04:32:39 -04:00
|
|
|
PostProcessor: &HCL2PostProcessor{
|
|
|
|
PostProcessor: &MockPostProcessor{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-07-28 04:02:37 -04:00
|
|
|
},
|
|
|
|
{
|
2020-07-02 05:07:59 -04:00
|
|
|
{
|
|
|
|
PType: "manifest",
|
2020-07-06 04:32:39 -04:00
|
|
|
PostProcessor: &HCL2PostProcessor{
|
|
|
|
PostProcessor: &MockPostProcessor{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
&packer.CoreBuild{
|
2020-07-02 05:07:59 -04:00
|
|
|
Type: "amazon-ebs.aws-ubuntu-16.04",
|
2020-06-05 05:51:23 -04:00
|
|
|
Prepared: true,
|
|
|
|
Builder: emptyMockBuilder,
|
|
|
|
Provisioners: []packer.CoreBuildProvisioner{},
|
|
|
|
PostProcessors: [][]packer.CoreBuildPostProcessor{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PType: "manifest",
|
2020-07-06 04:32:39 -04:00
|
|
|
PostProcessor: &HCL2PostProcessor{
|
|
|
|
PostProcessor: &MockPostProcessor{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-07-28 04:02:37 -04:00
|
|
|
},
|
|
|
|
{
|
2020-07-02 05:07:59 -04:00
|
|
|
{
|
|
|
|
PType: "amazon-import",
|
2020-07-06 04:32:39 -04:00
|
|
|
PostProcessor: &HCL2PostProcessor{
|
|
|
|
PostProcessor: &MockPostProcessor{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
|
|
|
{"provisioner with only and except",
|
|
|
|
defaultParser,
|
|
|
|
parseTestArgs{"testdata/build/provisioner_onlyexcept.pkr.hcl", nil, nil},
|
|
|
|
&PackerConfig{
|
|
|
|
Basedir: filepath.Join("testdata", "build"),
|
|
|
|
Sources: map[SourceRef]SourceBlock{
|
|
|
|
refVBIsoUbuntu1204: {Type: "virtualbox-iso", Name: "ubuntu-1204"},
|
|
|
|
refAWSEBSUbuntu1604: {Type: "amazon-ebs", Name: "ubuntu-1604"},
|
|
|
|
},
|
|
|
|
Builds: Builds{
|
|
|
|
&BuildBlock{
|
2020-07-02 05:07:59 -04:00
|
|
|
Sources: []SourceRef{
|
|
|
|
refVBIsoUbuntu1204,
|
|
|
|
SourceRef{Type: "amazon-ebs", Name: "ubuntu-1604", LocalName: "aws-ubuntu-16.04"},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
ProvisionerBlocks: []*ProvisionerBlock{
|
|
|
|
{
|
|
|
|
PType: "shell",
|
2020-07-02 05:07:59 -04:00
|
|
|
OnlyExcept: OnlyExcept{Only: []string{"virtualbox-iso.ubuntu-1204"}},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
PType: "file",
|
2020-07-02 05:07:59 -04:00
|
|
|
OnlyExcept: OnlyExcept{Except: []string{"virtualbox-iso.ubuntu-1204"}},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PType: "shell",
|
|
|
|
OnlyExcept: OnlyExcept{Only: []string{"amazon-ebs.aws-ubuntu-16.04"}},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
PType: "file",
|
|
|
|
OnlyExcept: OnlyExcept{Except: []string{"amazon-ebs.aws-ubuntu-16.04"}},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false, false,
|
2020-12-09 06:39:54 -05:00
|
|
|
[]packersdk.Build{
|
2020-06-05 05:51:23 -04:00
|
|
|
&packer.CoreBuild{
|
|
|
|
Type: "virtualbox-iso.ubuntu-1204",
|
|
|
|
Prepared: true,
|
|
|
|
Builder: emptyMockBuilder,
|
|
|
|
Provisioners: []packer.CoreBuildProvisioner{
|
|
|
|
{
|
|
|
|
PType: "shell",
|
2020-07-02 12:02:19 -04:00
|
|
|
Provisioner: &HCL2Provisioner{
|
|
|
|
Provisioner: &MockProvisioner{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
{
|
|
|
|
PType: "file",
|
2020-07-02 12:02:19 -04:00
|
|
|
Provisioner: &HCL2Provisioner{
|
|
|
|
Provisioner: &MockProvisioner{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
|
|
|
},
|
|
|
|
&packer.CoreBuild{
|
2020-07-02 05:07:59 -04:00
|
|
|
Type: "amazon-ebs.aws-ubuntu-16.04",
|
2020-06-05 05:51:23 -04:00
|
|
|
Prepared: true,
|
|
|
|
Builder: emptyMockBuilder,
|
|
|
|
Provisioners: []packer.CoreBuildProvisioner{
|
|
|
|
{
|
|
|
|
PType: "file",
|
2020-07-02 12:02:19 -04:00
|
|
|
Provisioner: &HCL2Provisioner{
|
|
|
|
Provisioner: &MockProvisioner{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
{
|
|
|
|
PType: "shell",
|
2020-07-02 12:02:19 -04:00
|
|
|
Provisioner: &HCL2Provisioner{
|
|
|
|
Provisioner: &MockProvisioner{
|
|
|
|
Config: MockConfig{
|
|
|
|
NestedMockConfig: NestedMockConfig{Tags: []MockTag{}},
|
|
|
|
NestedSlice: []NestedMockConfig{},
|
|
|
|
},
|
2020-07-02 05:07:59 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-05 05:51:23 -04:00
|
|
|
},
|
|
|
|
PostProcessors: [][]packer.CoreBuildPostProcessor{},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
false,
|
|
|
|
},
|
2019-12-17 05:25:56 -05:00
|
|
|
}
|
|
|
|
testParse(t, tests)
|
|
|
|
}
|