Commit Graph

362 Commits

Author SHA1 Message Date
Patrik f8e31bff12
feat(builder): bump scaleway to new sdk (#9902) 2020-09-09 10:27:48 +02:00
Sylvia Moss 58a0bdd780
Look for a default resource pool when root resource pool is not found (#9809) 2020-08-31 16:26:48 +02:00
Adrien Delorme 5ba134ac5b
JSON to HCL2 (minimal best-effort) transpiler (#9659)
hcl2_upgrade transforms a JSON build-file in a HCL2 build-file.
This starts a validated Packer core and from that core we generate an HCL 'block' per plugin/configuration. So for a builder, a provisioner, a post-processor or a variable. The contents of each block is just transformed as is and basically all fields are HCL2-ified.
A generated field can be valid in JSON but invalid on HCL2; for example JSON templating (in mapstructure) allows to set arrays of strings - like `x = ["a", "b"]` - with single strings - like `x="a"` -, HCL does not allow this.
Since JSON does not make the distinction between variables and locals, everything will be a variable. So variables that use other variables will not work.
hcl2_upgrade tries to transform go templating interpolation calls to HCL2 calls when possible, leaving the go templating calls like they are in case it cannot.

Work:
* transpiler
* tests
* update hcl v2 library so that output looks great.
* update docs
2020-08-25 10:51:43 +02:00
Adrien Delorme fbfe31ceaf
update flock + go mod tidy (#9805) 2020-08-24 10:49:43 +02:00
Sylvia Moss a1524bf96a
Add option to also import OVF templates to the Content Library (#9755) 2020-08-19 13:20:25 +02:00
Megan Marsh 5016df92b8
fix vendoring 2020-08-11 15:04:47 -07:00
Li Kexian 94a32dc282
tencentcloud cvm use CLOUD_PREMIUM disk by default (#9663) 2020-07-29 15:10:00 +02:00
Adrien Delorme ddea6183fe tidy vendor/mod 2020-07-16 15:47:29 +02:00
Megan Marsh 629a8aec15 go mod vendor 2020-07-15 14:20:09 -07:00
Shengjing Zhu 4fe9a92058 Bump gophercloud to latest version 2020-07-14 00:01:37 +08:00
Sylvia Moss 9c1409dbba
Add content_library_destination to import VM template to a Content Library (#9551) 2020-07-10 11:01:10 +02:00
mingsheng.su 8a8abdf615
update ucloud-uhost builder (#9466)
* update ucloud-uhost builder, docs and deps

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
2020-06-24 14:31:05 +02:00
Gennady Lipenkov fcfbdc6b08 Update Yandex.Cloud go packages "go-genproto" and "go-sdk"
'go mod vendor' included
2020-06-17 12:35:43 +03:00
Megan Marsh 4178625afb re-add winrm_no_proxy option. Winrm code needs to be modified in order to read no_proxy env var when client is created rather than when net/http library is instantiated. 2020-06-16 10:27:30 -07:00
Charlie Kenney 70a2c7d364
upgrade linodego to v0.14.0 (#9395)
* upgrade linodego to v0.14.0

* fix builder/linode linter errors

* Update go.mod

Co-authored-by: Adrien Delorme <adrien.delorme@icloud.com>
2020-06-12 11:36:54 +02:00
Moss 698e4cda15 update vmware/govmomi to v0.22.2 2020-06-10 14:38:17 +02:00
Sylvia Moss aa52e690ee
Update go-getter and add samba shared files tests to step_download (#8954) 2020-06-04 15:00:18 +02:00
Adrien Delorme 0fa60c68fb
Drop the iso_checksum_type & iso_checksum_url fields (#8437)
* Drop the iso_checksum_type & iso_checksum_url fields

In favor of simply using iso_checksum that will know what to do.

* fix after master merge

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* remove checksum lowercasing tests

* Update builder_test.go

* Update builder_test.go

* better docs

* Update builder_test.go

* even better docs

* Update config.go

* Update builder_test.go

* Update step_create_vmx_test.go

* make generate

* better docs

* fix imports

* up tests

* Update _ISOConfig-required.html.md

* Update builder_test.go

* don't use sha1.Sum("none") as a caching path

* Update builder_test.go

* better docs

* Update iso_config_test.go

remove ISOChecksumType/ISOChecksumURL references

* Update step_download_test.go

* add iso_checksum_url and iso_checksum_type fixers + tests

* add concrete examples of checksum values

* add examples of checksumming from local file

* update go-getter dep

* up deps

* use new go-getter version

* up ESX5Driver.VerifyChecksum: use go-getter's checksumming

* ISOConfig.Prepare: get checksum there in case we need it as a string in ESX5Driver.VerifyChecksum

* Update iso_config.go

* get go-getter from v2 branch

* Update driver_esx5.go

add more comments

* Update driver_esx5.go

* show better error message when the checksum is invalid

* Update builder_test.go

put in a valid checksum to fix tests, checksum is md5("packer")

* Update builder_test.go

test invalid and valid checksum

* more test updating

* fix default md5 string to be a valid md5

* TestChecksumFileNameMixedCaseBug: use 'file:' prefix for file checksumming

* Update iso_config_test.go

* Update iso_config_test.go

* Update builder_test.go

* Update builder_test.go

* Update builder_test.go

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update go.mod

* Update go.mod

* Update CHANGELOG.md
2020-05-28 11:02:09 +02:00
Megan Marsh 782342a707
Merge pull request #9202 from overdrive3000/improve-secrets-manager
Add support for specifying key to fetch from AWS Secrets Manager
2020-05-20 13:13:28 -07:00
Adrien Delorme 5fdd1d1dee get github.com/hashicorp/go-cty-funcs@0d04eb807361 2020-05-20 15:51:34 +02:00
Juan Mesa 78509a58e7 Remove github.com/overdrive3000/secretsmanager package from vendors 2020-05-15 14:04:07 +02:00
Wilken Rivera b5639d4697
tests/builder/amazon: Enhance the test coverage for SSM Tunnel related steps (#9213)
* test/builder/amazon: Update mocks to properly test SSM tunnel and driver code base

* Update mod files
2020-05-13 10:10:55 -04:00
Adrien Delorme 4ebcbad332
update consul and vault dependencies (#9205)
* update consul and vault dependencies

* update triton sign call accorting to https://github.com/joyent/triton-go/pull/135

* Delete readme.md

* put back github.com/mitchellh/reflectwalk to v1.0.0 and explain why

* fix/fixer_pp_docker_tag_tags.go: simplify deduplication loop and keep seen/stable order
2020-05-11 15:26:01 -04:00
Sylvia Moss 25971b3b5c
Add pwd to gogetter ChecksumFromFile (#9129) 2020-05-11 11:14:50 +02:00
Wilken Rivera 16604373ac initial ssm tunnel changes - not working 2020-05-08 09:32:48 -04:00
Paul Meyer 26d768f429
[builder/azure-chroot] Shared image source (#9070) 2020-04-23 11:03:17 +02:00
Wilken Rivera 4844e101ce
Merge pull request #9104 from hashicorp/up_oci_sdk
update github.com/oracle/oci-go-sdk v1.8.0 to v18.0.0+incompatible
2020-04-22 15:04:18 -04:00
Adrien Delorme 493a2a8a40 update github.com/oracle/oci-go-sdk v1.8.0 to v18.0.0+incompatible and go mod tidy
fix #9085
2020-04-22 15:28:52 +02:00
Juan Mesa 0fca4a8ba8 Add template function aws_secretsmanager
Allow users to read secrets from AWS Secrets Manager via
packer template functions
2020-04-21 18:37:29 +02:00
Li Kexian 632610d9c0
fixed InstanceOperationInProgress error #9054 2020-04-15 12:38:50 +08:00
Paul Meyer 6131301fdd Standardize compute SDK version 2020-04-07 22:49:24 +00:00
Vaijanath Angadihiremath 20379c9eff Rebasing with origin/master and fixing issues 2020-04-02 18:15:08 -07:00
Megan Marsh 9af1ee29e4 ran go mod vendor 2020-04-02 17:25:09 -07:00
Vaijanath Angadihiremath 02aef0fb8d Updating the module dependencies 2020-04-02 17:15:29 -07:00
Vaijanath Angadihiremath 645cdf1a59 Updating the modules to include update to autorest 12.4 2020-04-02 17:13:36 -07:00
Megan Marsh 1963f3aa6f
Merge pull request #8893 from itzimourakas/feature7379
[WIP] Feature7379 - https://github.com/hashicorp/packer/issues/7379
2020-04-01 09:33:25 -07:00
jhawk28 99b0b98311
Add ovf export capability to vsphere builders (#8764)
* add ovf export capability to vsphere builders

* remove unneeded floppy ejection

* add prepare step for export. updated output directory to be the actual destination directory

* add step export documentation

* add extra export options

* add ui messages for export step

Co-authored-by: Megan Marsh <megan@hashicorp.com>
Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2020-03-19 13:51:43 -04:00
Megan Marsh 564c8891d5 add keyvault portion of azure sdk 2020-03-18 13:48:54 -07:00
Sylvia Moss 2319521aa5
Add iso config test for checksum from file specific case (#8897) 2020-03-18 11:32:51 +01:00
Ilias Tzimourakas 0f2cb45fc6 added instance principals support for oci builder 2020-03-15 17:22:06 +00:00
Adrien Delorme 0c45bd8b4f import new replace and regex replace funcs from go-cty + documentation 2020-03-10 16:14:25 +01:00
Calle Pettersson 81a65dac4f Bump proxmox-api-go 2020-02-26 08:47:44 +01:00
Adrien Delorme a8fcb2d91a
HCL2: add support for dynamic blocks, document for loops and splat expressions (#8720) 2020-02-20 10:51:34 +01:00
Li Kexian f3231018ca
showing tencentcloud image id after copy to desination region (#8763) 2020-02-18 11:17:19 +01:00
Adrien Delorme a19214afeb Allow to use isos in place 2020-02-06 17:07:58 +01:00
Adrien Delorme 193dad46e6
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 11:49:21 +01:00
Yu SungDuk df18187032
builder/ncloud: Migrate ncloud-sdk-go-v1 to ncloud-sdk-go-v2 (#8678) 2020-02-03 14:55:01 +01:00
Calle Pettersson d70d1e8bf7 Bump proxmox-api-go 2020-01-17 22:17:28 +01:00
Megan Marsh e87aa237dd Get plugin up to parity with v1.5.0. Remove custom jetbrains-internal testing logic; disable acceptance tests (for now) until we can set up a test rig inside of HashiCorp. Regenerate code based on vendoring changes. 2020-01-08 14:41:51 -08:00
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