56 Commits

Author SHA1 Message Date
Adrien Delorme
1075120109
use the SDK version 0.0.11 (#10572) 2021-02-04 17:52:40 +01:00
Adrien Delorme
ed091163be
HCL2 Parse packer.required_plugins block + packer init (#10304)
This adds the new `required_plugins` block to be nested under the packer block.

Example:
```hcl
packer {
  required_plugins {
    aws = {
      version = ">= 2.7.0"
      source = "azr/aws"
    }
    azure = ">= 2.7.0"
  }
}
```

For example on darwin_amd64 Packer will install those under :
* "${PACKER_HOME_DIR}/plugin/github.com/azr/amazon/packer-plugin-amazon_2.7.0_x5.0_darwin_amd64"
* "${PACKER_HOME_DIR}/plugin/github.com/hashicorp/azure/packer-plugin-azure_2.7.0_x5.0_darwin_amd64_x5"

+ docs
+ tests
2021-02-02 18:05:04 +01:00
Sylvia Moss
d1ada744e1
Aws Secrets Manager data sources (#10505) 2021-01-22 14:49:45 +01:00
Sylvia Moss
291121dd55
(2) Implement datasources (#10440) 2021-01-20 10:37:16 +01:00
Adrien Delorme
52d2d7fe5f
Copy MapOf... plugin types back into Packer core (#10466)
* move maps of plugins back in core

* go mod vendor

* more fixes

* fix imports

* Update core_test.go

* fix build

* more fixes

* more fixes

* up vendors after fixing sdk

* Update post_processor_mock.hcl2spec.go

* Leave implementatino of MapOf in the sdk for plugi tests

Other wise use the interface

* go mod tidy

* add MapOfDatasource type too
2021-01-13 12:14:06 +01:00
Megan Marsh
6564ee76e8 fix vendoring 2021-01-07 15:45:16 -08:00
Megan Marsh
77c3c12244 fix vendoring 2021-01-07 15:44:58 -08:00
Megan Marsh
37652b05eb update vendoring 2020-12-17 15:12:16 -08:00
Adrien Delorme
f3e65b5eb1 use "github.com/hashicorp/go-cty-funcs/collection".CoalesceFunc
fix #9419
after https://github.com/hashicorp/go-cty-funcs/pull/5 was merged
2020-09-30 11:59:36 +02:00
Megan Marsh
4c0ac6917e switch to using aws base config, which means we're using code tested and maitnained by the terraform crowd. 2020-09-29 14:26:38 -07: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
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
Adrien Delorme
5fdd1d1dee get github.com/hashicorp/go-cty-funcs@0d04eb807361 2020-05-20 15:51:34 +02: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
Sylvia Moss
2319521aa5
Add iso config test for checksum from file specific case (#8897) 2020-03-18 11:32:51 +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
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
Adam Dobrawy
3b091e6046 builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
Megan Marsh
124ae7d225 add vendored code 2019-10-28 14:38:53 -07:00
Megan Marsh
5ab31b0363 Revert "vendor vendors"
This reverts commit 8b1fcbb3bd40512cd2f2320705d64d6f483ddcb8.
2019-10-28 14:31:07 -07:00
Adrien Delorme
8b1fcbb3bd vendor vendors 2019-10-15 12:56:42 +02:00
Adrien Delorme
4748958cca go get go get github.com/hashicorp/go-getter@master && tidy 2019-09-06 11:59:23 +02:00
Megan Marsh
e85bac737b update go-getter client in vendors folder 2019-06-28 14:38:54 -07:00
Radek Simko
3e65b5dbcb
vendor: github.com/hashicorp/go-version@v1.2.0 2019-05-06 22:28:27 +01:00
Adrien Delorme
2f97dc2933 go mod vendor && go mod tidy 2019-04-11 14:19:24 +02:00
Adrien Delorme
9f82b75e57 Use the hashicorp/go-getter to download files
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
2019-03-13 12:11:58 +01:00
Matthew Hooker
ab723eaf78
Update oracle SDK 2018-10-26 16:59:22 -07:00
Matthew Hooker
8598e2d0a3
WIP 2018-10-26 16:59:20 -07:00
Megan Marsh
dfaf624f4c add template function allowing user to read keys from vault
update dependencies
add minimal docs
2018-08-28 11:23:47 -07:00
Olivier Ceyral
a906d1d630 Add consul template function 2018-08-28 11:04:33 -07:00
Matthew Hooker
ddf23a2c46
Complete Atlas deprecation.
Removes the push command and the Atlas post-processor.  Please see our
guide on building immutable infrastructure with Packer on CI/CD for
ideas on implementing these features yourself.
https://www.packer.io/guides/packer-on-cicd/
2018-08-02 20:23:28 -07:00
Megan Marsh
e21981e581 fix vendor commit for go-oracle-terraform 2018-06-26 16:21:19 -07:00
Megan Marsh
871ead371a Clean up based on Oracle comments 2018-01-31 10:47:19 -08:00
Matthew Hooker
967b858fc3
add go-oracle client 2018-01-25 14:33:42 -08:00
Matthew Hooker
3bf431a423
construct OCI client 2018-01-25 14:33:41 -08:00
Matt McQuillan
e0942e8998 Updating go-checkpoint lib to have a fixed timeout 2017-10-10 12:48:29 -04:00
Megan Marsh
535268cf85 update atlas-go to fix symlink-related packer push failures 2017-08-08 09:40:44 -07:00
Matthew Hooker
83ba291f41
update go-checkpoint 2017-06-23 19:36:32 -07:00
Matthew Hooker
6ff34c8788
update go-checkpoint 2017-06-16 17:56:41 -07:00
Matthew Hooker
35332e4498
fix panic with deadlines. update panicwrap dep 2017-06-15 13:23:05 -07:00
Matthew Hooker
7382382727
Add telemetry reporting through checkpoint
Will report builders/provisioner/post-processor types used per build,
and whether or not the build passed.

Will also report any panics we see.

You may opt out of this reporting by setting the environment variable
`CHECKPOINT_DISABLE`.
2017-06-15 13:21:11 -07:00
Matthew Hooker
1533f5564f
update changelog 2017-06-08 15:44:51 -07:00
Megan Marsh
fdca364f4b allow user to mark variables as sensitive for packer push 2017-06-08 13:01:23 -07:00
James Nugent
237180a95b deps: Add joyent/triton-go 2017-04-26 14:02:04 -07:00
Justin Campbell
fdaa89681a
Update go-atlas.
Use the atlas.BuildVars type.

The -var/-var-file precedence issue is a bug documented in #2682. Not
introduced in this patch
2016-11-07 12:52:32 -08:00
Chris Bednarski
4348f5f54d Update atlas-go to get ATLAS_TLS_NOVERIFY option for packer push command 2016-10-12 15:04:35 -07:00
Matthew Hooker
d08f1b503f Applies govenor migrate godep
Updates contributing and make file

Removes empty vendor package

Removes go 1.4 logic
2016-10-05 15:49:22 -07:00