Commit Graph

81 Commits

Author SHA1 Message Date
Adrien Delorme 6d4fae0f2d
Add HCL2 aws_secretsmanager function (#10124)
* refactor aws get secrets function out to reuse it else where
* add aws_secretsmanager func and docs for HCL2
* fix GetSecret: allow to pick secret version
2020-10-20 16:21:40 +02:00
Megan Marsh cc7dbf6092
Add consul_key function to integrate concul with hcl2 tempaltes. (#10119)
* Add consul_key function to integrate concul with hcl2 tempaltes.
* sidebar nav
2020-10-19 14:07:13 +02:00
Wilken Rivera 20eeffee0d
integration/secretsmanager: Add support for AWS SharedConfig file (#9781)
This changes updates the AWS Secrets manager session authentication
logic to support reading the AWS configuration file for default
credentials and region settings, if they are not provided via
environment variables.

* Modify error output a little to remove stutter "error ... : error ...`

Results before change
```
unset AWS_REGION
⇶  ~/pkg/packer build amazon-ebs_secretsmanager_shell-local.json
template: root:1:3: executing "root" at <aws_secretsmanager `packer/test/keys`
`shell`>: error calling aws_secretsmanager: Error getting secret: MissingRegion:
could not find region configuration
```

Results after change
```
unset AWS_REGION
⇶  ~/pkg/packer build amazon-ebs_secretsmanager_shell-local.json
null: output will be in this color.

==> null: Running local shell script: /tmp/packer-shell721444992
    null: powershell
Build 'null' finished after 4 milliseconds 121 microseconds.

==> Wait completed after 4 milliseconds 192 microseconds

==> Builds finished. The artifacts of successful builds are:
```
2020-08-18 10:51:48 -04:00
Wilken Rivera 56f6a976de
integrations/secretsmanager: Add support for plaintext, non key/pair, secrets (#9773) 2020-08-17 13:41:21 +02:00
jsmcnair 78c280b1b7 Use common funcs / fix panic / clarify docs 2020-08-12 22:34:13 +01:00
Megan Marsh 4a058dfd19 un-bypass secretsmanager tests 2020-05-26 11:50:46 -04:00
Juan Mesa cc34da365a Add error check
Thrown an error if no key is given when secret has mutliple values
2020-05-23 15:15:06 +02:00
Megan Marsh 8f73a44410 stop failing flaky test until I can fix it 2020-05-21 10:24:42 -07:00
Juan Mesa b73602eadd Fix corrections
* Fix typos in comments.
* Add documentation of how to use multiple keys with `aws_secretsmanager` function.
* Move `Client` struct to `secretsmanager.go` file.
2020-05-19 13:16:28 +02:00
Juan Mesa 55fa3e1b0b Add support for specifying key to fetch from AWS Secrets Manager 2020-05-15 13:50:33 +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
Juan Manuel Mesa 75efe3fcd1
Clean linting issues for packages template and interpolate (#9120) 2020-04-27 10:35:47 +02:00
Juan Mesa e6dbbe454e Fix linting issues 2020-04-21 19:20:45 +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
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Megan Marsh 0cfcbd66ca
execute_command in powershell wasn't interpolating build vars properly (#8771) 2020-03-02 04:20:32 -05:00
Wilken Rivera 9ec8b67392
Add golangci-lint to project (#8686)
* Add golangci-lint as linting tool

* Disable failing staticchecks to start; GitHub issue to handle coming soon

* Run `goimports -w` to repair all source files that have improperly
formatted imports

* makefile: Add ci-lint target to run on travis

This change adds a new make target for running golangci-lint on newly
added Go files only. This target is expected to run during Packer ci builds.

* .github/contributing: Add code linting instructions

* travis: Update job configuration to run parallel builds
2020-02-14 11:42:29 -05:00
Sylvia Moss 23fa3107a3
Render variables one time on prepare method (#8727) 2020-02-13 17:35:23 +01:00
Sylvia Moss 328eb8ee96
Interpolate boot_command when defined by user variable (#8640) 2020-01-27 19:10:16 +01:00
Megan Marsh 8490bbc45c add tests for info sharing 2019-12-17 13:41:48 -08:00
Megan Marsh cd7abf1f9e clean up a few final issues with info sharing 2019-12-17 11:20:57 -08:00
Megan Marsh 6bc5a95c3a tweak docs; change to 2019-12-16 21:35:42 -08:00
Megan Marsh 0f6d1beccf add an extra string array to the Prepare() return values in the builder interfaces; this sets up the ability for builders to give the provisioners custom user-accessible build-time variables. 2019-12-16 21:23:05 -08:00
Megan Marsh d47f151bf9 punctuation 2019-12-14 03:38:27 -08:00
Megan Marsh 82367a88f8 reorganize placeholder data call to live with provisioner implementation; force users to use the generated function, therefore forcing validation, for all variables except winrmpassword, by doing a simple string check against the placeholder data. 2019-12-14 03:32:38 -08:00
Megan Marsh 39fd462b56 change all provision func signatures to use map[string]interface{} 2019-12-12 15:38:32 -08:00
Megan Marsh 0ca7c9f397 fix tests 2019-12-11 16:29:35 -08:00
Megan Marsh 5d266b20d0 generated func now validates based on data provided in context, which needs to include the future values if it is to be interpolated properly. 2019-12-11 15:43:38 -08:00
Megan Marsh 528b853178 stub out generated func for validation 2019-12-11 15:43:38 -08:00
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
Adrien Delorme 0f14077664 Merge remote-tracking branch 'origin/master' into switch_sed_because_license 2019-09-23 12:38:52 +02:00
Adrien Delorme df0b06a87a make sed template call deprecated
and link to docs
2019-09-20 11:08:15 +02:00
Adrien Delorme adad25b50b fix switch statement 2019-09-17 16:25:44 +02:00
Adrien Delorme feb3da4f56 replace sed usage with replace and replace_all funcs 2019-09-17 16:02:05 +02:00
Adrien Delorme a279d2e071 template funcs: got force template funcs to be 'FuncGenerator' 2019-09-17 16:01:22 +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
Megan Marsh e54b1cedd9 text/template turns out to swallow custom error types. 2019-07-08 15:39:46 -07:00
Megan Marsh 2bbc3d50d7 better error handling when using interpolate funcs; don't swallow func errors 2019-07-08 13:49:14 -07:00
Adrien Delorme c11ef90cb6 use interpolate.NewContext() instead of testConfigTemplate(t)
because it's what's happenning there
2019-06-14 12:17:28 +02:00
Adrien Delorme c4f3dccc14 rename interpolation context from ctx to ictx and contexts to ctx to avoid conflicts 2019-04-03 15:56:15 +02:00
Megan Marsh bf0d7b3620 make it work and add tests 2019-03-13 10:49:13 -07:00
Wheeler Law 4582a55680 Formatting 2018-11-05 12:30:41 -08:00
Wheeler Law 1fdce9dada Tests are passing 2018-11-05 12:30:41 -08:00
Wheeler Law de3bdec567 Working now 2018-11-05 12:30:41 -08:00
Wheeler Law 65c1b039cc Added a sed function. Not quite working yet 2018-11-05 12:30:41 -08:00
Megan Marsh 174098ba29 implement vault template function for kv engine; add docs 2018-08-28 13:58:56 -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 ee08365b02 Fix error message 2018-08-28 11:04:33 -07:00
Olivier Ceyral a906d1d630 Add consul template function 2018-08-28 11:04:33 -07:00
Megan Marsh 6356078d19 add a few more tests to split function 2018-08-24 15:27:14 -07:00