packer-cn/vendor/github.com
Adrien Delorme 0785c2f6fc
build using HCL2 (#8423)
This follows #8232 which added the code to generate the code required to parse
HCL files for each packer component.

All old config files of packer will keep on working the same. Packer takes one
argument. When a directory is passed, all files in the folder with a name
ending with  “.pkr.hcl” or “.pkr.json” will be parsed using the HCL2 format.
When a file ending with “.pkr.hcl” or “.pkr.json” is passed it will be parsed
using the HCL2 format. For every other case; the old packer style will be used.

## 1. the hcl2template pkg can create a packer.Build from a set of HCL (v2) files

I had to make the packer.coreBuild (which is our one and only packer.Build ) a public struct with public fields

## 2. Components interfaces get a new ConfigSpec Method to read a file from an HCL file.

  This is a breaking change for packer plugins.

a packer component can be a: builder/provisioner/post-processor

each component interface now gets a `ConfigSpec() hcldec.ObjectSpec`
which allows packer to tell what is the layout of the hcl2 config meant
to configure that specific component.

This ObjectSpec is sent through the wire (RPC) and a cty.Value is now
sent through the already existing configuration entrypoints:

 Provisioner.Prepare(raws ...interface{}) error
 Builder.Prepare(raws ...interface{}) ([]string, error)
 PostProcessor.Configure(raws ...interface{}) error

close #1768


Example hcl files:

```hcl
// file amazon-ebs-kms-key/run.pkr.hcl
build {
    sources = [
        "source.amazon-ebs.first",
    ]

    provisioner "shell" {
        inline = [
            "sleep 5"
        ]
    }

    post-processor "shell-local" {
        inline = [
            "sleep 5"
        ]
    }
}

// amazon-ebs-kms-key/source.pkr.hcl

source "amazon-ebs" "first" {

    ami_name = "hcl2-test"
    region = "us-east-1"
    instance_type = "t2.micro"

    kms_key_id = "c729958f-c6ba-44cd-ab39-35ab68ce0a6c"
    encrypt_boot = true
    source_ami_filter {
        filters {
          virtualization-type = "hvm"
          name =  "amzn-ami-hvm-????.??.?.????????-x86_64-gp2"
          root-device-type = "ebs"
        }
        most_recent = true
        owners = ["amazon"]
    }
    launch_block_device_mappings {
        device_name = "/dev/xvda"
        volume_size = 20
        volume_type = "gp2"
        delete_on_termination = "true"
    }
    launch_block_device_mappings {
        device_name = "/dev/xvdf"
        volume_size = 500
        volume_type = "gp2"
        delete_on_termination = true
        encrypted = true
    }

    ami_regions = ["eu-central-1"]
    run_tags {
        Name = "packer-solr-something"
        stack-name = "DevOps Tools"
    }
    
    communicator = "ssh"
    ssh_pty = true
    ssh_username = "ec2-user"
    associate_public_ip_address = true
}
```
2019-12-17 11:25:56 +01:00
..
1and1/oneandone-cloudserver-sdk-go go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
Azure update go-ntlmssp dependency to fix upstream bug affecting winrm users 2019-11-15 13:08:38 -08:00
BurntSushi/toml builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
ChrisTrenkamp/goxpath Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
NaverCloudPlatform/ncloud-sdk-go add ncloud-sdk-go dependency to vendor 2018-01-11 19:41:47 +09:00
PuerkitoBio/goquery up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
StackExchange/wmi update go modules 2019-09-18 10:33:16 -07:00
Telmate/proxmox-api-go Bump vendor/ 2019-10-27 13:10:35 +01:00
agext/levenshtein add vendored code 2019-10-28 14:38:53 -07:00
aliyun Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
andybalholm/cascadia up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
antchfx Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
antihax/optional builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
apparentlymart/go-textseg add vendored code 2019-10-28 14:38:53 -07:00
approvals/go-approval-tests go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
armon go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
aws/aws-sdk-go adding temporary instance profile document policy 2019-10-19 20:56:18 +11:00
bgentry go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
biogo/hts post-processor/compress: add bgzf format support 2016-05-13 11:51:00 +02:00
c2h5oh/datasize go mod vendor && go mod tidy 2019-04-12 01:29:34 +03:00
census-instrumentation/opencensus-proto builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
cheggaaa/pb Use the hashicorp/go-getter to download files 2019-03-13 12:11:58 +01:00
chzyer/readline vendors 2019-06-06 15:04:02 -07:00
creack/goselect Bump goselect version to include mips/ppc/s390x 2019-04-25 15:40:09 -04:00
davecgh/go-spew go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
dgrijalva/jwt-go go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
digitalocean Vendor Qemu QMP builder dependencies 2019-07-10 12:30:41 -06:00
dimchansky/utfbom update vendor directory 2019-10-15 21:14:20 +00:00
docker/docker go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
dustin/go-humanize go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
dylanmei Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
exoscale/egoscale fixup! Add Exoscale Import post-processor 2019-07-01 08:59:37 +02:00
fatih up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
ghodss/yaml go mod vendor && go mod tidy 2019-04-12 01:29:34 +03:00
go-ini/ini go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
go-ole/go-ole update go modules 2019-09-18 10:33:16 -07:00
gobwas/glob up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
gocolly/colly up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
gofrs replace github.com/gofrs/flock => github.com/azr/flock v0.0.0-20190823144736-958d66434653 2019-09-05 17:03:54 +02:00
golang builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
golang-collections/collections Delete stack_test.go 2019-07-26 12:34:25 +02:00
google builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
googleapis/gax-go/v2 go get go get github.com/hashicorp/go-getter@master && tidy 2019-09-06 11:59:23 +02:00
gophercloud [builder/openstack] adds option to discover provisioning network 2019-10-29 13:02:27 -04:00
gorilla/websocket Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
grpc-ecosystem update go modules 2019-09-23 21:09:10 +03:00
hashicorp builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
hetznercloud/hcloud-go chore: bump hcloud dependency 2019-08-13 08:40:47 +02:00
hyperonecom/h1-client-go builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
jdcloud-api/jdcloud-sdk-go Rewrite all files, remove sensitive information 2019-08-09 15:00:23 +08:00
jehiah/go-strftime feat: add strftime function in templates 2019-10-11 14:35:39 +05:30
jmespath/go-jmespath GO111MODULE=on go mod vendor && git add vendor/github.com/aws && git add github.com/jmespath/go-jmespath 2019-01-18 12:48:57 +01:00
joyent/triton-go go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
json-iterator/go update alicloud builder to use official SDK (#7477) 2019-04-26 10:37:49 +08:00
jstemmer/go-junit-report builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
kardianos/osext Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
kennygrant/sanitize up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
klauspost ran go mod vendor 2019-10-11 12:15:37 -07:00
konsorten/go-windows-terminal-sequences go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
kr/fs Revert "Remove a bunch of unused dependencies (godep v54+ required)" 2016-02-22 11:44:12 -08:00
linode/linodego ran go mod vendor 2019-10-11 12:15:37 -07:00
masterzen Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
mattn update to newest version of go-tty to fix control flow bug 2019-11-12 10:17:21 -08:00
mitchellh add vendored code 2019-10-28 14:38:53 -07:00
modern-go update alicloud builder to use official SDK (#7477) 2019-04-26 10:37:49 +08:00
moul go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
nu7hatch/gouuid go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
olekukonko/tablewriter go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
oracle/oci-go-sdk go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
outscale/osc-go add missing vendor dependencies 2019-07-18 09:39:07 -07:00
packer-community/winrmcp update winrmcp vendor and update error message in file provisioner to aid user who messes up file path name. update file provisioner docs 2018-09-21 14:51:32 -07:00
pierrec/lz4 go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
pkg update go modules 2019-09-23 21:09:10 +03:00
pmezard/go-difflib Fixed github.com/stretchr/testify deps 2016-09-12 12:53:01 +02:00
posener/complete Revert "vendor vendors" 2019-10-28 14:31:07 -07:00
profitbricks/profitbricks-sdk-go refresh line endings 2019-05-17 14:58:20 -07:00
renstrom/fuzzysearch add vendor deps 2018-02-08 12:10:12 -08:00
ryanuber/go-glob go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
saintfish/chardet up go mod, go mod vendor & go mod tidy 2019-06-06 17:34:17 +02:00
satori/go.uuid go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
scaleway/scaleway-cli go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
shirou ran go mod vendor 2019-10-11 12:15:37 -07:00
sirupsen/logrus builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
stretchr/testify update go modules 2019-09-23 21:09:10 +03:00
temoto/robotstxt Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-08-21 16:44:23 +02:00
tencentcloud/tencentcloud-sdk-go fixed get copy region value (#8345) 2019-11-07 11:12:19 +01:00
ucloud/ucloud-sdk-go go mod vendor 2019-10-30 10:48:41 -07:00
ufilesdk-dev/ufile-gosdk go mod vendor 2019-10-30 10:48:41 -07:00
ugorji/go go mod vendor 2019-10-30 10:49:33 -07:00
ulikunitz/xz ran go mod vendor 2019-10-11 12:15:37 -07:00
vmware/govmomi go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
xanzy/go-cloudstack gomod: update go-cloudstack 2019-05-26 11:58:26 +02:00
yandex-cloud update yandex-cloud/go-sdk & yandex-cloud/go-genproto 2019-09-23 21:18:33 +03:00
zclconf/go-cty build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00