118 Commits

Author SHA1 Message Date
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
Adam Dobrawy
3b091e6046 builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
Megan Marsh
452ca602ee update go-ntlmssp dependency to fix upstream bug affecting winrm users 2019-11-15 13:08:38 -08:00
Megan Marsh
53bbce4cd7 update to newest version of go-tty to fix control flow bug 2019-11-12 10:17:21 -08:00
Li Kexian
f2f544c434 fixed get copy region value (#8345) 2019-11-07 11:12:19 +01:00
Adrien Delorme
5ddd02d1c0
Cut version 1.4.5 2019-11-04 18:43:29 +01:00
Megan Marsh
991af72758 checkout go.mod and go.sum from master, rebuild 2019-10-30 10:47:13 -07:00
Megan Marsh
58b94574c5 clean up dependencies 2019-10-30 09:33:09 -07:00
Megan Marsh
9c02d7c1eb fix modules 2019-10-29 16:11:44 -07:00
mingsheng.su
61f9d3a9fe add ucloud import 2019-10-29 16:11:43 -07:00
Adrien Delorme
889ab163f1
Merge pull request #8241 from carlpett/bump-proxmox-api
Bump proxmox dependency
2019-10-29 14:45:41 +01:00
Megan Marsh
1d489d1899 revert bad commit and re-vendor code. 2019-10-28 14:38:18 -07:00
Megan Marsh
5ab31b0363 Revert "vendor vendors"
This reverts commit 8b1fcbb3bd40512cd2f2320705d64d6f483ddcb8.
2019-10-28 14:31:07 -07:00
Calle Pettersson
9e00438453 Bump proxmox-api 2019-10-27 13:03:31 +01:00
Megan Marsh
d15f43e4eb
Merge pull request #8232 from hashicorp/artifact-tree
HCL2 configs - part one
2019-10-22 11:54:34 -07:00
Megan Marsh
0c2fba089d
Merge pull request #8250 from tencentyun/master
tencentcloud-cvm builder: we added retry on remote api call to improve the user experience
2019-10-21 14:45:37 -07:00
Li Kexian
6fb8988d08
we added retry on remote api call to improve the user experience 2019-10-21 13:21:56 +08:00
Adrien Delorme
cf1555bf17 Merge remote-tracking branch 'origin/master' into artifact-tree 2019-10-16 10:22:56 +02:00
Paul Meyer
b9c726417f update modules 2019-10-15 21:14:20 +00:00
Adrien Delorme
8b1fcbb3bd vendor vendors 2019-10-15 12:56:42 +02:00
psinghal20
7f1f77b8c6
chore: tidy up go.mod
Signed-off-by: psinghal20 <psinghal20@gmail.com>
2019-10-11 14:35:44 +05:30
psinghal20
6492995a20
feat: add strftime function in templates
This commit adds strfttime function in templates to provide conventional format for ISO time based on C standard.

Signed-off-by: psinghal20 <psinghal20@gmail.com>
2019-10-11 14:35:39 +05:30
Megan Marsh
17d4e54947
Cut version 1.4.4 2019-10-01 11:29:00 -07:00
Megan Marsh
4644af7b66
Merge pull request #8131 from hashicorp/fix_8036
Fix 8036
2019-10-01 09:40:11 -07:00
Megan Marsh
e31a28bb77 fix generated files for update I committed directly to master 2019-09-27 13:51:38 -07:00
Gennady Lipenkov
91733c49bb update yandex-cloud/go-sdk & yandex-cloud/go-genproto 2019-09-23 21:18:33 +03:00
Gennady Lipenkov
6708641942 update go modules 2019-09-23 21:09:10 +03:00
Megan Marsh
ca51bff695
Merge pull request #8119 from hashicorp/switch_sed_because_license
templating: deprecate `sed` with `replace` and `replace_all`
2019-09-23 09:41:03 -07:00
Adrien Delorme
9f6be64f43 Merge remote-tracking branch 'origin/master' into fix_7277_le_deux 2019-09-23 12:43:24 +02:00
Adrien Delorme
0f14077664 Merge remote-tracking branch 'origin/master' into switch_sed_because_license 2019-09-23 12:38:52 +02:00
Megan Marsh
87b3a1f99d update aws sdk 2019-09-20 10:04:37 -07:00
Adrien Delorme
3fe9d52e3f Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-20 11:15:44 +02:00
Megan Marsh
11c87a786a update go modules 2019-09-18 10:33:16 -07:00
Adrien Delorme
52afb3ab05 go mod tidy && go mod vendor 2019-09-17 16:02:56 +02:00
Gennady Lipenkov
a6c3145fdb update yandex-cloud/go-sdk & yandex-cloud/go-genproto 2019-09-10 18:52:55 +03:00
Adrien Delorme
597a3e323b Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-10 13:20:07 +02:00
Adrien Delorme
aa9cc919ab Merge branch 'master' into circle_ci_windows 2019-09-10 12:54:35 +02:00
Adrien Delorme
146b88ba1e Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-10 12:44:46 +02:00
Calle Pettersson
8c2c1a82cb Bump proxmox-api-go dependency 2019-09-07 23:07:45 +02:00
Adrien Delorme
4748958cca go get go get github.com/hashicorp/go-getter@master && tidy 2019-09-06 11:59:23 +02:00
Adrien Delorme
44ba58321d pin to go 1.13 & cleanup go deps 2019-09-05 17:11:08 +02:00
Adrien Delorme
1d00daedac replace github.com/gofrs/flock => github.com/azr/flock v0.0.0-20190823144736-958d66434653
to test my fix
2019-09-05 17:03:54 +02:00
Adrien Delorme
1151641424 fix broken git.apache.org/thrift.git link 2019-09-04 14:50:28 +02:00
Adrien Delorme
4cb7c30987 Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-08-21 16:44:23 +02:00
Andre Hilsendeger
d832cd6f67 chore: bump hcloud dependency 2019-08-13 08:40:47 +02:00
Megan Marsh
067cb1475f
Merge pull request #7967 from bdwyertech/update-aws-sdk
Update aws-sdk-go to v1.22.2
2019-08-12 16:34:28 -07:00
Brian Dwyer
ecd118b6c2
Update aws-sdk-go to v1.22.2
Signed-off-by: Brian Dwyer <Brian.Dwyer@broadridge.com>
2019-08-09 13:01:30 -04:00
xiaohan.liang
f4fc9dd09a Rewrite all files, remove sensitive information 2019-08-09 15:00:23 +08:00
Thomas Meckel
a4d168ec4b Corrected go.mod and modules.txt 2019-07-26 12:34:24 +02:00
Megan Marsh
975ee377b2
Merge pull request #7792 from psinghal20/issue-7721
set openstack image metadata with use_blockstorage_volume
2019-07-18 11:58:01 -07:00