Commit Graph

310 Commits

Author SHA1 Message Date
Megan Marsh 818d9bb087 send to step run spot instance 2019-11-21 13:21:56 -08:00
Megan Marsh 67c3373107 enable no_ephemeral for spot devices, clean up ranging behavior, update docs 2019-11-21 12:46:31 -08:00
Megan Marsh 08e97ba4d8 generate code for no_ephemeral option 2019-11-20 13:49:04 -08:00
Megan Marsh 0e2bdc8be6 forcibly prevent ephemeral drives from being created in the amazon-ebs builder, when no_ephemeral is set 2019-11-20 13:42:14 -08:00
nywilken f9f4726eff builder/amazon/step_pre_validate: Add check for non-default VPCs
Subnet information is only really needed when the specified `vpc_id` is
not the default VPC for the region where the builder is being executed.
This change uses the AWS API to determine if the VPC provided is a
non-default VPC and only validates the existence of a `subnet_id` if a
user has provided a non-default `vpc_id`.

Tests after change
```
> make test TEST=./builder/amazon/... TESTARGS='-count=1 -v -run=TestStepPreValidate_checkVpc'
...

=== RUN   TestStepPreValidate_checkVpc
=== RUN   TestStepPreValidate_checkVpc/DefaultVpc
=== RUN   TestStepPreValidate_checkVpc/NonDefaultVpcNoSubnet
=== RUN   TestStepPreValidate_checkVpc/NonDefaultVpcWithSubnet
=== RUN   TestStepPreValidate_checkVpc/SubnetWithNoVpc
=== RUN   TestStepPreValidate_checkVpc/NoVpcInformation
--- PASS: TestStepPreValidate_checkVpc (0.00s)
    --- PASS: TestStepPreValidate_checkVpc/DefaultVpc (0.00s)
    --- PASS: TestStepPreValidate_checkVpc/NonDefaultVpcNoSubnet (0.00s)
    --- PASS: TestStepPreValidate_checkVpc/NonDefaultVpcWithSubnet (0.00s)
    --- PASS: TestStepPreValidate_checkVpc/SubnetWithNoVpc (0.00s)
    --- PASS: TestStepPreValidate_checkVpc/NoVpcInformation (0.00s)
PASS

...
```
2019-11-18 16:44:09 -05:00
Megan Marsh dfa134cd98 ditch else statement for improved clarity 2019-11-18 10:11:59 +01:00
Megan Marsh ce8bca349f Update builder/amazon/ebs/step_create_ami.go
Co-Authored-By: Adrien Delorme <azr@users.noreply.github.com>
2019-11-18 10:11:59 +01:00
Megan Marsh a35ac0127e fix bug in step_region_copy 2019-11-18 10:11:59 +01:00
Megan Marsh 5614f307fb regerate code
generate flat FlatPolicyDocument
add PolicyDocument to generate command
2019-10-23 10:46:07 -07:00
Megan Marsh d15f43e4eb
Merge pull request #8232 from hashicorp/artifact-tree
HCL2 configs - part one
2019-10-22 11:54:34 -07:00
Bernard Baltrusaitis 8b83cca064 adding temporary instance profile document policy 2019-10-19 20:56:18 +11:00
Adrien Delorme 078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Megan Marsh 0cbd3ff0f3 make sure amazon builders respect ssh_host option 2019-09-26 12:30:04 -07:00
Adrien Delorme 3fe9d52e3f Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-20 11:15:44 +02:00
Megan Marsh 1d9bba6fe3 change AMIEncryptBootVolume to trilean 2019-08-22 14:04:26 -07:00
Megan Marsh 1a6adadb89 convert EnableAMIENASupport to trilean in code 2019-08-22 13:18:22 -07: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 54d2ad5028 refactored step_ami_region_copy to fix bugs and clarify assumptions; added more tests for that step.
fix race condition caused by variable declaration outside of loop
2019-07-17 11:30:20 -07:00
Megan Marsh 6ad975f296 Revert "move SSHInterface/SSHIPVersion fields to communitator.Config struct"
This reverts commit b0c09087a2.
2019-07-02 10:46:10 -07:00
Megan Marsh c722afe707 stop calculating spot bids; amazon changed the way spot instances are priced to be stable rather than bid-based, so when user sets auto, we can just default to the ondemand price and know that they'll get the same price as everyone else bidding at that time. 2019-07-01 13:01:41 -07:00
Adrien Delorme 9f4c8fb321 document ebs builder using partials 2019-06-18 17:41:50 +02:00
Adrien Delorme c696878d2e aws block devices mapping: BlockDevices.Build -> BuildEC2BlockDeviceMappings() 2019-06-18 12:44:24 +02:00
Adrien Delorme ff2e0298ba simplify block devices utilisation by removing intermediary types 2019-06-18 12:37:47 +02:00
Megan Marsh 0d55bc46ee add skip_save_build_region flag to fix naming conflicts when building for multiple regions 2019-06-17 14:39:11 -07:00
Adrien Delorme 8e857d64f1 aws: rewrap struct comments for documentation generation 2019-06-06 17:34:17 +02: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 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 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 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
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