Commit Graph

993 Commits

Author SHA1 Message Date
Megan Marsh 1c3b234b55
Merge pull request #7737 from hashicorp/document_retry
retry.Backoff: document
2019-06-13 10:54:08 -07:00
Adrien Delorme 98206d59d7 aws: step_create_tags make the max waiting time 30s and not 30ns 2019-06-11 12:37:52 +02:00
Pratyush Singhal d92e82c43f refactor: replace the maxBackoff from 30 nanosecond to 30 seconds
Co-Authored-By: Adrien Delorme <azr@users.noreply.github.com>
2019-06-11 16:01:03 +05:30
Pratyush singhal d4b0cb68e3 feat: add retry for temp key-pair generation in amazon-ebs
Signed-off-by: Pratyush singhal <psinghal20@gmail.com>
2019-06-10 22:45:02 +05:30
Megan Marsh 3f036b33c5 test for length of ami tags before tagging 2019-06-03 19:14:06 -07:00
Megan Marsh 078d888dba
Merge pull request #7707 from CARFAX/master
Enable encrypted AMI sharing across accounts
2019-06-03 13:08:06 -07:00
Jason McIntosh abef9820c7 Fixed spacing on comment 2019-05-30 17:25:36 -05:00
Jason McIntosh 24a4e2f23e Updated comments 2019-05-30 17:18:33 -05:00
Jason McIntosh 24bc50ce1b Enable encrypted AMIs with custom KMS Keys 2019-05-30 17:16:36 -05:00
Megan Marsh 6786c0d641 update tests to reflect new behavior 2019-05-30 16:17:23 -05:00
Megan Marsh bda09bf7d5 the build ami is made with an intermediary name, which means that we can't skip copying even from the original build region when unencrypted 2019-05-24 15:08:20 -07:00
Megan Marsh 708165eaa8 refactoring step_run_spot_instance and swapping out the calls to create a spot instance with a call to create a spot fleet of one, so that we can be more flexible with the instance type when desired 2019-05-24 09:32:54 -07:00
Megan Marsh 1062295ecd add omit_from_artifact option for ebssurragote launch_block_devices 2019-05-10 11:12:11 -07:00
Megan Marsh 2cfba56265 fix typos 2019-05-07 16:44:29 -07:00
Megan Marsh 02c9f24531 allow user to set architecture 2019-05-07 16:38:55 -07:00
Megan Marsh 2c352cc681 add tests for step_ami_region_copy 2019-05-03 14:47:09 -07:00
Megan Marsh ae3cf48f71 in ebs, don't clean up temporary amis from encryption step. that's handled in step_copy_ami now 2019-05-02 14:38:56 -07:00
Megan Marsh 8c1d0f9686 clean up temporary unencrypted AMI and associated snapshots 2019-05-02 14:20:26 -07:00
Megan Marsh c0e69a9da0 if encrypt_boot is explicitly set to false, don't copy. Also, make sure we don't cause a wait group block when we aren't performing a copy. 2019-05-02 13:28:43 -07:00
Megan Marsh 105d3f8853 delete unencrypted temporary snapshot when encrypt_boot is true. Also, fix nil map error in region copy 2019-04-17 12:55:30 -07:00
Megan Marsh 201c8c1332 make sure that you encrypt using the provided kms key id and not the default 2019-04-15 16:44:56 -07:00
Adrien Delorme aee73d745d update code after go mod update 2019-04-11 14:19:24 +02:00
Adrien Delorme d72040f4fa move retry code into the common/retry pkg and make retry context aware 2019-04-09 17:46:38 +02:00
Adrien Delorme f555e7a9f2 allow a provisioner to timeout
* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi
NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer.
Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock
* cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions
* also had to simplify StartWithUi
2019-04-08 20:09:21 +02:00
Adrien Delorme a81abd297b Merge remote-tracking branch 'origin/master' into context_provisioner 2019-04-08 20:09:01 +02:00
Megan Marsh 3e72e65a6c
Merge pull request #7456 from hashicorp/do_5770
introduce the clean_resource_name to clean image/var names
2019-04-05 09:12:20 -07: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
Adrien Delorme a4bf94dd3c change Builder to be passed a context for cancellation
we have to to give it to our hook
2019-04-03 15:55:55 +02:00
Adrien Delorme 9836dad0c9 introduce the clean_resource_name to clean image names and deprecate the old ones 2019-04-03 11:25:51 +02:00
Akshat Mahajan f07e4214cc Addresses issues #5384, #5494: Rename and change `temporary_security_group_source_cidr`
to accept a list of strings (for Amazon builders).

Per this change, `temporary_security_group_source_cidr` in the configuration:

1. Will be renamed to `temporary_security_group_source_cidrs`.
2. Will accept a list of CIDRs.
3. Will have its documentation updated to reflect this change.
4. Will have a fixer attached for newer templates to avail of.
2019-03-30 15:47:03 -07:00
programmer04 596a9cc7ff Improve error message for AWS and Alibaba 2019-03-15 23:38:05 +01: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
Megan Marsh 0196d7f835
Merge pull request #7370 from sargun/allow-users-to-specify-custom-block-device-mapping
amazon-chroot: Allow users to specify custom block device mapping
2019-03-12 14:21:23 -07:00
Megan Marsh 3ed9fe6dee remove unused imports
remove HttpClientWithEnvironmentProxy from amazon builders; let access config handle it
2019-03-04 16:42:33 -08:00
Megan Marsh 0ed57a37a3 dont overwrite session config in ebs builder 2019-03-04 16:41:31 -08:00
Megan Marsh ca9a5daf29 fix proxy and tls 2019-03-04 16:41:31 -08:00
Sargun Dhillon 601e754438 amazon/chroot: Allow creating new block device mappings !not fromScratch
Previously, when you built from an existing image, you were unable
to reconfigure block device mappings, as it just took them and
copied them over. This allows users to specify new, custom
block device mappings, even when building from an existing
image.
2019-03-04 13:11:14 -08:00
Megan Marsh ec3b0a5138 fix conflict from mergeing too many things to master at once 2019-03-01 11:13:32 -08:00
Megan Marsh 9d2b06bd61
Merge pull request #7342 from hashicorp/fix_7316
swap region copy and encryption steps
2019-03-01 10:26:43 -08:00
Megan Marsh 0abd16527e
Merge pull request #7337 from sargun/fix-chroot-builder
Amazon-chroot: Fix building PV images and where mount_partition is set
2019-03-01 10:25:04 -08:00
Adrien Delorme f535464097 up a test 2019-02-27 11:17:56 +01:00
Adrien Delorme f03cbd8a10 aws: allow to pass nil bool as encryption parameter
to retain current encryption settings

this changes the fields :
* ami_config.encrypt_boot
* block_device.encrypted

This also removes StepCreateEncryptedAMICopy as this step is now done in StepAMIRegionCopy
2019-02-27 11:17:56 +01:00
Adrien Delorme ce8532e94b aws: document ValidateRegion better 2019-02-27 11:17:08 +01:00
Adrien Delorme 6af621c37a aws: StepAMIRegionCopy call waitgroup.add only once 2019-02-27 11:17:08 +01:00
Michael F 01a0b0c766 kmsArnStartPattern - fix support for aws-us-gov
While the `kmsArnStartPattern` regexp supports `us-gov` as a region, it does not take the AWS partition into consideration.
For more info see https://docs.aws.amazon.com/govcloud-us/latest/ug-east/using-govcloud-arns.html

Added test case for AWS partition us-gov as well as a negative test case for a non-existing AWS partition.
2019-02-26 16:54:54 -08:00
Megan Marsh 026e543b24 move snapshot deletion to cleanup; this allows people with tag-specific permissions to perform snapshot deletion operation 2019-02-25 17:01:19 -08:00
Megan Marsh 3b726e66c1 swap region copy and encryption steps 2019-02-25 11:03:03 -08:00
Sargun Dhillon 142a84ef43 amazon/chroot: Refactor step_register_ami for testing EBS-related behaviour
There is some logic around how EBS mappings are handled / generated depending
on whether an image if from scratch or not. There was no testing around
this behaviour before. This strips that logic out into a separate function,
to enable testing it independentlhy.
2019-02-25 10:45:23 -08:00
Sargun Dhillon d3c65ee77d builder/amazon/chroot: Fix building PV images with mount_partition
Right now, if we have a source image that's PV, and try to build an
image with mount_partition set to not 0, it does not get picked up.
This is because under PV we only had a filesystem, not partitions,
but you can convert a PV image to an HVM image during build time.
2019-02-22 18:21:01 -08:00
Megan Marsh 2a613dd6e9 fix up the github suggestion 2019-02-11 11:49:17 -08:00