329 Commits

Author SHA1 Message Date
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
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
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
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
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
Megan Marsh
3b726e66c1 swap region copy and encryption steps 2019-02-25 11:03:03 -08:00
Megan Marsh
3704a053d0 move region validation and credential wait into step pre validate 2019-02-05 14:07:04 -08:00
Megan Marsh
035c3506ba manually set proxyfromenvironment in default http client for ec2 sessions 2019-01-25 12:33:25 -08:00
Megan Marsh
fbb3d526e3 move region validation to run so that we don't break validation when we don't have aws creds set 2018-11-20 15:01:28 -08:00
Megan Marsh
9573013d3a
Merge pull request #6872 from aspectcapital/disable-ena-support
Add support to explicitly disable ENA support
2018-10-19 10:54:38 -07:00
Matt Dainty
feb8067c7d Convert ena_support to a pointer
This means it now has three states, `true`, `false`, & `nil`. The
default state is now `nil` which does nothing instead of `false` which
now will explicitly disable ENA support instead of just not enabling it.
2018-10-19 12:40:43 +01:00
Megan Marsh
57f87f58b9
Merge pull request #6374 from rickard-von-essen/aws-filters
builder/amazon: Add suppport for vpc_filter, subnet_filter, and security_group_filter
2018-10-18 14:34:02 -07:00
Adrien Delorme
22d3e9b5c4 builder/amazon/ebs: pass config as a pointer so values could be populated by a run 2018-09-27 16:27:34 +02:00
Matthew Hooker
9181570bc3
remove stray struct dumps in logs 2018-09-27 00:14:05 -07:00
Megan Marsh
79093da6ad skip region validation in tests that don't care; refactor Prepare func so we can test region validation logic with a mock 2018-09-19 10:30:08 -07:00
Megan Marsh
38cc525ec7 new option allowing user to clean up the ephemeral ssh key from the authorized_keys file 2018-09-14 11:06:38 -07:00
Adrien Delorme
2e73ed8d46 pass Comm instance to fix Spot instance creation 2018-09-11 18:20:14 -07:00
Adrien Delorme
e02d0dacc4
Merge branch 'master' into aws-filters 2018-09-07 16:14:00 +02:00
Megan Marsh
b94e6e913e
Merge pull request #6670 from sargun/fix-ena-on-pv
Allow users to build hvm images from pv images to have ena_support
2018-09-06 12:50:46 -07:00
Adrien Delorme
b80e1d51c6 aws: when building an AMI with 'encrypt_boot: true', randomize the name of the temporary AMI 2018-09-05 10:24:28 +02:00
Sargun Dhillon
902497d6ce Allow users to build hvm images from pv images to have ena_support 2018-09-04 18:16:52 -07:00
RenaudS
26aab49aaf aws spot instances: add block_duration_minutes option (#6638)
* Add block_duration_minutes option

* int64 cannot be nil

* Update doc

* Fix formating
2018-09-03 08:33:58 +02:00
Adrien Delorme
df9e756865 pass the Comm instance to the amazon ebs builders steps 2018-08-30 12:50:29 +02:00
Adrien Delorme
b0c09087a2 move SSHInterface/SSHIPVersion fields to communitator.Config struct 2018-08-29 14:51:28 +02:00
Adrien Delorme
ef4ca9c48e builder.amazon: use c.Comm for ssh 2018-08-29 14:40:33 +02:00
Adrien Delorme
293c485372 builder.aws: use SSHAgentAuth from Comm 2018-08-29 14:40:33 +02:00
Adrien Delorme
ef08c441c9 builder.aws: use Comm field for StepKeyPair & StepGetPassword 2018-08-29 14:40:33 +02:00
Adrien Delorme
51d2aac9f6 SSHPrivateKey => SSHPrivateKeyFile 2018-08-29 14:40:32 +02:00
Matthew Hooker
e41e99954d
go 1.11 format rules 2018-08-24 15:56:44 -07:00
Rickard von Essen
533967cb66 builder/amazon: Add suppport for security_group_filter
Allow selecting SG's using a filter. Also some cleanup of vpc_filter and
subnet_filter.
2018-08-24 12:42:38 +02:00
Megan Marsh
340363a649
Merge pull request #6613 from hashicorp/merge_ssh_config_funcs
Merge ssh config funcs from builders
2018-08-23 16:03:36 -07:00
Rickard von Essen
9840862757 builder/amazon: Add suppport for vpc_filter and subnet_filter
First step of adding support for discovering VPC's and Subnets using
filters.
2018-08-23 12:52:03 +02:00
Adrien Delorme
41f6e0334d refactor all copy pasted sshConfig with into communicator.Config.SSHConfigFunc
* still need to append the auth methods into an array for gracefullness
2018-08-22 17:02:23 +02:00
Megan Marsh
ff6a039d5b replace scrubconfig with packer.LogSecretFilter.Set
filter winrm password from logs
Add new root-level packer template option, sensitive-variables, to tell us what user variables to mark sensitive.
2018-08-20 15:35:55 -07:00
Matthew Hooker
31fcfe4bc2 PoC for filtering logs 2018-08-20 15:20:21 -07:00
Anshul Sharma
c1edcd3774
amazon-ebssurrogate clean up volumes 2018-07-26 09:38:59 +03:00
James Nugent
9fffe4056e
Merge pull request #5452 from smaato/tag-spot-requests
Enable tagging of spot requests
2018-07-16 13:00:07 -05:00
Megan Marsh
f49a2d8aed move UI call to before the wait; add context to these steps 2018-07-11 10:36:21 -07:00
Megan Marsh
cf63dd10bf replace AMIStateRefreshFunc, InstanceStateRefreshFunc, our spot instance waiter, our chroot volume waiter, and our snapshot waiters with waiters form AWS's SDK. 2018-07-11 10:34:20 -07:00
Mark Meyer
3dbf1cb371 Enable tagging of spot requests
This adds a new parameter to the EBS builders named `spot_tags'. This
parameter accepts a map of tags, much like `tags'. These tags will be
applied to a spot request that is created.

Improve visibility.
2018-07-07 16:06:51 +02:00
DanHam
d5304a25e9
Pass T2 Unlimited settings to run instance step for appropriate EC2 builders 2018-05-15 12:25:06 +01:00
Matthew Hooker
0521efa200
correctly log reason waiting for ami failed. 2018-05-03 12:27:09 -07:00
AlessioT
3d4c7d0df1 Feature Request: Log reason why AMI creation failed 2018-04-30 20:59:13 +01:00
AlessioT
373226e9c5 Extract state reason for failure 2018-04-28 12:40:48 +01:00
AlessioT
09bb21774d alessio.tomasino@yahoo.co.uk 2018-04-28 11:02:53 +01:00
AlessioT
c27f3e9445 alessio.tomasino@yahoo.co.uk 2018-04-28 11:00:33 +01:00
Megan Marsh
3afb243f11 use build name to ensure that winrm password and other shared state is not overwritten if two builders need the password in the same packer run. 2018-04-16 13:41:17 -07:00
Matthew Hooker
21812fa17f
Add volume and run tags if in us-gov/china
We can't tag on instance creation when we're in "restricted" regions,
so let's add the tags after the resources have been created.

Adds methods to AccessConfig to detect if we're in China or US Gov
regions (i.e. "restricted").

Also turns tag:tag maps into a type, and moves methods around validating
and converting them to ec2Tags to methods of the type.
2018-02-05 16:39:20 -08:00