Commit Graph

797 Commits

Author SHA1 Message Date
Megan Marsh 79862f1bbb
Merge pull request #6931 from hashicorp/fix_6919
aws: better error handling of region/credential guessing from metadata
2018-11-05 11:24:09 -08:00
Adrien Delorme 3f288fc6ca aws client: config.WithMaxRetries(8) 2018-11-01 15:09:07 +01:00
Mikhail Ushanov 4608b5d39d amazon: add option for skipping TLS verification
Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
2018-10-29 21:35:29 +03:00
Adrien Delorme f4fbf45349 remove duplicate region check error 2018-10-26 17:44:56 +02:00
Adrien Delorme 16aa21dffe aws: better error handling of region guessing from metadata
* this will fix #6919
2018-10-26 12:24:10 +02:00
Adrien Delorme ed793a8fb8 make ValidateRegion a member of *AccessConfig and make it variadic 2018-10-24 11:26:53 +02:00
Megan Marsh fe044d8ff7 fix tests 2018-10-23 13:31:56 -07:00
Megan Marsh 340009009d Revert "Revert "Merge pull request #6892 from hashicorp/fix_6890""
This reverts commit 0cd3f36d50.
2018-10-23 09:58:27 -07:00
Megan Marsh 0cd3f36d50 Revert "Merge pull request #6892 from hashicorp/fix_6890"
This reverts commit 1c4062c316, reversing
changes made to 9bc41a23b9.
2018-10-23 09:34:05 -07:00
Megan Marsh 0924a316b7 fix template-set credentials
update tests with mocked session
2018-10-22 13:53:40 -07: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
Megan Marsh 2266514408
Merge pull request #6843 from gmmephisto/pr-master-aws-security-group
aws: wait for temporary security group before authorize rules
2018-10-17 14:08:49 -07:00
Megan Marsh e7d3a30c0e
Merge pull request #6865 from hashicorp/fix_6862
Fix 6862
2018-10-17 13:07:29 -07:00
Mikhail Ushanov 00c96fc400 aws: use IpPermissions for authorizing temporary security group
Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
2018-10-17 22:00:25 +03:00
Mikhail Ushanov b316be51cd aws: wait for temporary security group before authorizing
Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
2018-10-17 22:00:24 +03:00
Megan Marsh b0cfecf314 remove unnecessary valid flag 2018-10-17 11:03:31 -07:00
Matt Dainty 9e0fae9db3 Add support to explicitly disable ENA support
If `ena_support` is set to false then it previously didn't do anything
whereas now it will explicitly disable ENA support.

Fixes #6852
2018-10-17 14:58:07 +01:00
Megan Marsh d4767845f0 fix tests 2018-10-16 15:01:13 -07:00
Megan Marsh 7c3f0aa3b2 make sure region validation catches authentication errors 2018-10-16 14:17:30 -07:00
Mikhail Ushanov ee133482b4 aws: add validation for device_name parameter
cause it's required in block-device-mapping.

Signed-off-by: Mikhail Ushanov <gm.mephisto@gmail.com>
2018-10-16 21:37:48 +03:00
Megan Marsh 02bfac118f default wait time for amazon import to one hour. 2018-10-09 13:08:42 -07:00
Megan Marsh f494d87dc5
Merge pull request #6747 from hashicorp/fix_6743
abort if image import fails
2018-10-09 12:56:28 -07:00
Adrien Delorme f44dfcc62f
Merge pull request #6727 from hashicorp/fix_6723
reset poll delay seconds default to 2 because it can actuall be used …
2018-10-03 11:15:42 +02:00
Megan Marsh d616f0ba71 abort if image import fails 2018-09-20 13:18:59 -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 93f1155a14 remove test-related special casing 2018-09-18 08:08:36 -07:00
Anshul Sharma ef3c10c403 Modify Validate Region for test cases 2018-09-17 14:45:55 -07:00
Anshul Sharma 98f13eaf29 Use DescribeRegions for aws region validation 2018-09-17 14:45:55 -07:00
Megan Marsh f4e6d06e68 reset poll delay seconds default to 2 because it can actuall be used in one part of the conditional tree for applyEnvOverrides 2018-09-17 11:10:50 -07:00
Adrien Delorme 770f61e682 spot instance creation, only set blockDurationMinutes when > 0 2018-09-12 10:21:39 -07:00
Matt DeBoer 09797df958 use a UI wrapper to auto-decode error messages
update docs to reflect optional config
2018-09-11 16:05:43 -07:00
Megan Marsh a0edaf6c46 Going to revert this change for now, becuase of potential issues that arise from calling Prepare() twice
Revert "use statebag instead of SetSharedState for winRM password"

This reverts commit b35acbd879.
2018-09-10 16:48:42 -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
Sargun Dhillon 902497d6ce Allow users to build hvm images from pv images to have ena_support 2018-09-04 18:16:52 -07:00
Megan Marsh 349f9ae62b
Merge pull request #6641 from hashicorp/increase_retries
Increase retries
2018-09-04 11:39:28 -07:00
Adrien Delorme 2a2734505b
Merge pull request #6649 from hashicorp/fix_6569
Fix 6569
2018-09-03 08:44:07 +02: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
Megan Marsh 4472ecccb0 fix waiters that weren't applying env defaults 2018-08-31 13:30:41 -07:00
Megan Marsh 2b9f937c23 increase max retries from 3 to 20 2018-08-30 09:35:06 -07:00
Adrien Delorme b0c09087a2 move SSHInterface/SSHIPVersion fields to communitator.Config struct 2018-08-29 14:51:28 +02:00
Adrien Delorme 0938b640cc use key pair name from config 2018-08-29 14:40:33 +02:00
Adrien Delorme ef4ca9c48e builder.amazon: use c.Comm for ssh 2018-08-29 14:40:33 +02:00
Adrien Delorme 9a9b82715b config.Comm.SSHKeyPair => SSHKeyPairName 2018-08-29 14:40:33 +02:00
Adrien Delorme 3a4bb26150 builder.aws: use key pair from comm struct 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
Megan Marsh b35acbd879 use statebag instead of SetSharedState for winRM password 2018-08-24 13:51:16 -07:00
Rickard von Essen 23f62f221e Only filter SG's on VPC if it's set. Only use VPC's and Subnets that are available 2018-08-24 20:24:48 +02:00
Megan Marsh fa99f931b7
Merge pull request #6601 from hashicorp/fix_6536
Increase waiter timeout for AWS WaitUntilImageAvailable command
2018-08-24 09:35:58 -07:00
Adrien Delorme 6bbcd3e914
Remove remaining unused ssh config funcs and add missing calls (#6622)
* Remove duplicate unused SSHConfig funcs

* call to SSHConfigFunc() for azure/arm builder

* ncloud too

* remove empty ncloud file
2018-08-24 16:00:40 +02: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
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
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
Megan Marsh 00c6ec979f do 30 minutes not 25 2018-08-17 13:30:02 -07:00
Megan Marsh 00de0f4996 increase the timeout for waiting for an ami to become available 2018-08-17 13:27:19 -07:00
Megan Marsh 71cad4f2a9 fix tests 2018-08-14 12:30:05 -07:00
Megan Marsh 250da0ab49 fix security hole with ami filter 2018-08-13 17:01:13 -07:00
Anshul Sharma c1edcd3774
amazon-ebssurrogate clean up volumes 2018-07-26 09:38:59 +03:00
Matthew Hooker 814c1cf2b2
spellfix 2018-07-18 13:00:45 -07: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
Mark Meyer 2fec76ea87 Check if spot price is empty, when spot_tags is set 2018-07-13 22:42:42 +02:00
Megan Marsh b6b907f523 read in the environment variables that government wait time and polling time for the AWS wait in step_stop_ebs_volume 2018-07-13 09:43:28 -07:00
Megan Marsh 8e22803099 fix loading of environment variables for managing aws waiters 2018-07-11 13:10:38 -07:00
Megan Marsh f657ca39c9 refactored env var code and tests so that I don't have to set env vars during tests to check logic 2018-07-11 10:36:21 -07:00
Megan Marsh 14166fdd99 update amazon import docs to include the env vars for setting aws waiter delays and timeouts 2018-07-11 10:36:21 -07:00
Megan Marsh bfbe318727 fix the homegrown waiters
fix image import; issue was with wait options not being evaluated
2018-07-11 10:36:21 -07: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
EC2 Default User 58f73aabbf Add ap-northeast-3 region 2018-06-15 07:15:41 +00:00
DanHam af7f7f2ce9
Fix redundant Sprintf 2018-05-24 21:05:03 +01:00
DanHam ec8b70721c
Use an explicit error message when an error is expected and we don't get one
Previously, if the validation check generating the error in the main code
is removed, the 'should error' tests would just return an empty message
2018-05-15 12:25:06 +01:00
DanHam 82c8710af5
Use fmt.Errorf over errors.New as we only require basic error reporting 2018-05-15 12:25:06 +01:00
DanHam 99e3487795
Add missing validation and tests for Spot Instance requests 2018-05-15 12:25:06 +01:00
DanHam 6fc68754d7
Allow use of T2 unlimited by adding appropriate request for the instance 2018-05-15 12:25:06 +01:00
DanHam df7fb86984
Add tests for T2 Unlimited configuration 2018-05-15 12:25:06 +01:00
DanHam be02b3f613
Validate template settings when T2 Unlimited has been enabled
* T2 Unlimited cannot be used with anything other than T2 instance types
* T2 Unlimited cannot be used with Spot Instances
2018-05-15 12:25:06 +01:00
DanHam 482629ae90
Add config option to enable/disable T2 Unlimited for the launched instance 2018-05-15 12:25:06 +01:00
DanHam 2c339b99d2
Sort run config options alphabetically 2018-05-15 12:25:06 +01:00
DanHam 54e9690dff
Remove tmp files created by builder/amazon/common tests 2018-04-30 18:16:46 +01:00
Matthew Hooker cbdf9db832
Use contexts with amazon waiters. 2018-04-23 12:57:15 -07: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 f094b3be85
update changelog 2018-04-05 16:32:03 -07:00
Matthew Hooker 302b1988a5
Restrict deregistered AMIs to those owned by self. 2018-04-05 13:29:36 -07:00
ADO 04790695e6 Add interpolate_build_info_test tests 2018-03-30 16:46:35 +02:00
ADO 507b3619e7 Expose more source ami data in the template 2018-03-30 10:47:11 +02:00
Megan Marsh 072cd6b745
Merge pull request #5998 from hashicorp/do_5895
allow users of AWS to use the dynamically-generated admin password wh…
2018-03-22 16:01:22 -07:00
Matthew Hooker b16f2ec64b
builder/amazon: Use sdk default cred providers
I think we were overcomplicating things. The SDK provides the correct
credential chain by default, so let's use that. This patch does a quick
check for static credentials and uses those if found, then defaults to
the default credential provider chain.

This patch also removes the metadata timeout argument. Current versions
of the SDK have short timeouts by default, so I don't believe this is
needed.
2018-03-15 16:49:47 -07:00
Matthew Hooker e483087574
builder/amazon: Use service default retries.
Each service has its own preconfigured number of times to retry.
Lets use that instead of setting a global number.
2018-03-14 22:26:35 -07:00
Megan Marsh d689e6b4d3 allow users of AWS to use the dynamically-generated admin password which we use as the winRM password as an elevated password in the Powershell provisioner, as well as an environment variable in same provisoner. 2018-03-14 15:58:12 -07:00
Josh Soref 0171dfc890 spelling: validating 2018-03-14 03:28:19 +00:00
Josh Soref 007930ec2d spelling: restricted 2018-03-14 03:20:51 +00:00
Less Mo 686cacb435
builder/amazon: Added new region cn-northwest-1
Add new region China Ningxia cn-northwest-1.
2018-03-02 16:34:19 +08:00
Matthew Hooker 2806523834
Fix issue with assume role credentials 2018-02-15 14:54:01 -08:00
Matthew Hooker 19a89a101e
builder/amazon: remove ssh_private_ip
ssh_private_ip should now be set through ssh_interface.

Adds fixer to automatically fix existing json files
2018-02-08 16:47:43 -08:00
Matthew Hooker 5b64f71702
Merge pull request #5764 from hashicorp/fix5760
"borrow" access config code from terraform.
2018-02-08 14:55:43 -08: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
Matthew Hooker eafda52411
use amazon steps from master 2018-01-24 17:09:18 -08:00
Matthew Hooker 7a189a83a1
fix imports
`find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports -w {} \;`
2018-01-24 17:09:17 -08:00
Matthew Hooker a831d522be
change run signatures
Run now takes a context as well as a statebag. We'll assign the context
to the blank identifier to prevent namespace collisions. We'll let the
step authors opt-in to using the context.

`find . -iname "step_*.go" -exec gsed -i'' 's/func \(.*\)Run(/func \1Run(_ context.Context, /' {} \;`
2018-01-24 17:09:17 -08:00
Matthew Hooker a0c625ea44
Revert "working with opt-in"
This reverts commit 4068ffdaf541354e75507add7ca0b193993fcd52.
2018-01-24 17:09:16 -08:00
Matthew Hooker e98f201602
working with opt-in 2018-01-24 17:09:16 -08:00
Matthew Hooker 366dc3da0a
move multistep imports to helper.
gomvpkg -from "github.com/mitchellh/multistep" -to "github.com/hashicorp/packer/helper/multistep"
2018-01-24 17:09:15 -08:00
Matthew Hooker 807e88245b
trying to add context to state bag 2018-01-24 17:09:15 -08:00
Matthew Hooker cea2ab8c6d
move kms/encrypted validation to block devices 2018-01-12 15:10:51 -08:00
Jason Wieringa 2ac59b3c27 builder/amazon: Added KmsKeyID to BlockDevice
+ Adds kms_key_id to list of options
+ Tests that configuraiton is set along with encrypted
+ Updates documentation on ebsvolume builder
2018-01-11 20:27:38 -08:00
Matthew Hooker f5ea1e8312
Use WaitUntilInstanceReady waiter 2018-01-10 15:57:31 -08:00
Matthew Hooker c5bcb97d06
"borrow" access config code from terraform.
This gives us a few benefits:

* timeout early if metadata service can't be reached
* report which auth provider we're using
* give much better errors if something goes wrong
2018-01-04 15:04:07 -08:00
Matthew Hooker 98c2a2d1f7
builder/aws: catch static credential errors early.
If we're using static credentials, either both the access key and secret key must be set, or neither of them should be.
2018-01-04 11:50:27 -08:00
Matthew Hooker f3dea272d9
Set session in state bag
We can construct connections to arbitrary regions from it
2017-12-19 11:32:33 -08:00
Matthew Hooker 1c352726d7
Merge pull request #5719 from rchenv/issue5606
Ensure all AWS connections are configured alike
2017-12-19 11:32:24 -08:00
Rong Chen 3e92b1374e issue5606: follow the convention to use AccessConfig to create new aws session for step_create_tags etc. 2017-12-19 10:34:12 -08:00
Olivier Bazoud 8bcb469b8b builder/amazon: Added new region Paris - eu-west-3 2017-12-19 10:00:03 +01:00
Matthew Hooker f216330ba3
spot instance ena/sriov checking for all other builders 2017-12-08 14:56:19 -08:00
Matthew Hooker 73b98b2a04
use waiter to wait for ebs instances to stop 2017-12-08 13:38:48 -08:00
Matthew Hooker dada63801b
also use waiter code for spot instances 2017-12-08 13:38:48 -08:00
Matthew Hooker 9e61005f7c
Merge pull request #5660 from hashicorp/fix_5625
modify validation to allow user to have the original region in the am…
2017-12-08 13:36:10 -08:00
Ben Gnoinski 5df2e040d0 Update amazon run_config.go absent ssh_private_key_file error 2017-12-08 08:51:27 -08:00
Matthew Hooker 2c1c7b9659
Merge pull request #5630 from johndaviesco/winrm_no_proxy
Winrm no proxy
2017-12-07 15:41:16 -08:00
Matthew Hooker a90c45d9bb
Wait until source instance OK before continuing 2017-12-07 12:31:50 -08:00
Matthew Hooker 7b5c0900ef
Correctly set aws region if given in template along with a profile. 2017-12-07 11:12:57 -08:00
Megan Marsh 1c681fc096 tests 2017-11-30 14:08:48 -08:00
Megan Marsh 556da47d35 modify validation to allow user to have the original region in the ami_regions list 2017-11-30 13:51:33 -08:00
John Davies-Colley 10aaa49beb fixing tests and funky logic 💦 2017-11-28 14:42:14 +13:00
John Davies-Colley 0c787ec9df Valadating early 2017-11-28 11:46:32 +13:00
John Davies-Colley 75320440ec adding missing quote 🙏 2017-11-22 15:59:15 +13:00
John Davies-Colley 707ec675b2 ssh interface for amazon builders 🔨 2017-11-22 15:49:38 +13:00
Matthew Hooker 0a24f4eb2e
don't shadow package name 2017-11-07 16:05:43 -08:00
Matthew Hooker 545ee45567
debug region we found 2017-11-07 14:51:20 -08:00
Matthew Hooker c106e7c26c
Don't set region from metadata if profile is set. 2017-11-07 14:33:26 -08:00
Matthew Hooker 52fc0100eb
this is a critical error 2017-11-07 12:52:03 -08:00
Matthew Hooker 95e4ae251e
WIP 2017-11-02 09:03:44 -07:00
Matthew Hooker e87b468c6e
Merge pull request #5536 from hashicorp/fix5535
add delay option to security group waiter
2017-11-02 08:54:34 -07:00
Matthew Hooker 8ab390a048
Merge pull request #5495 from smaato/master
Fix regressions relating to spot instances and EBS volumes
2017-11-02 08:53:27 -07:00
Matthew Hooker f2413ff138
add delay option to security group waiter 2017-11-02 00:25:54 -07:00
Matthew Hooker d322fc6c19
Shorten metadata timeout
When running in travis, metadata requests will timeout after 5 seconds.
After 24 such timeouts, we'll hit travis' build timeout of two minutes,
and the build will fail. Lowering it to 100 gets us in a safe time
limit. We _may_ need to expose a timeout env var with this logic,
however.
2017-10-30 15:22:15 -07:00
Matthew Hooker 314fc94bd8
clean up 2017-10-30 15:02:39 -07:00
Matthew Hooker 0e4ea7420b
fix tests 2017-10-30 14:34:16 -07:00
Matthew Hooker c65fa8490d
fix various bugs deregistering AMIs
always deregister ami in session region
validate that session region does not appear in ami_regions
2017-10-30 14:17:19 -07:00
Matthew Hooker 6c4fbe8d87
use correct default region when deregistering AMIs. 2017-10-30 13:07:58 -07:00
Mark Meyer 7e1646826d Check if VolumeTags is empty before tagging volumes
Related to #5486
2017-10-23 21:10:40 +02:00
Matthew Hooker f7e269945e
add cidr validation and rename option 2017-10-12 17:05:56 -07:00
Matthew Hooker c74be87187 Merge pull request #5384 from dave2/sg-source-cidr
[WIP] Allow temporary security group to have source CIDR block explicit
2017-10-12 17:05:45 -07:00
Mark Meyer dbb3c76032 Remove redundant step and its usage
StepTagEBSVolumes is no longer needed, since this functionality is now
taken over by StepRunSourceInstance and StepRunSpotInstance. So remove
this functionality from the codebase.
2017-10-12 21:40:21 +02:00
Mark Meyer 2661fd7869 Move building of spot instances into its own step 2017-10-04 12:38:21 +02:00
Mark Meyer 939b44b4fd Add logic to handle volumes of spot instances 2017-10-03 01:03:21 +02:00
Mark Meyer cfd6b6fed5 Change EBS builder to do tag-on-creation
The EBS builder will now use the tag-on-creation pattern, so
that it's possible to restrict packer to only create volumes that are
properly tagged by using an AWS policy.
2017-10-03 00:13:02 +02:00
Megan Marsh 201e8c05a0 add ami name to output 2017-09-26 16:04:40 -07:00
Zanetti, David 8a8b51be97 Allow temporary security group to have source CIDR block explicitly provided 2017-09-26 00:57:56 +00:00
Zanetti, David 42dc1e4795 In Amazon builders, allow tag names to be interpolated like values 2017-09-25 02:24:23 +00:00
Megan Marsh 1adcce6046 Merge pull request #5284 from hashicorp/fix_5093
Allow granular modification of sriov and ena enhanced networking opti…
2017-08-29 14:28:42 -07:00
Megan Marsh f19040f3aa Merge pull request #5196 from cstuntz/aws-add-tags
Upgrade aws-sdk-go to 1.10.14, add tags at instance run time
2017-08-28 13:17:29 -07:00
Megan Marsh 2d4bc70d7b use ami prefix to make it clear that these variables are amazon specific
add fixer, fixer tests
2017-08-28 11:21:27 -07:00
Megan Marsh 9e2e467b31 Allow granular modification of sriov and ena enhanced networking options in amazon amis. Maintain old functionality. 2017-08-25 14:49:53 -07:00
Megan Marsh 7da52e1f77 Merge pull request #5250 from hashicorp/repro_3399
make force_deregister work in all regions, not just original region.
2017-08-24 14:41:02 -07:00
Łukasz Kostka 8703937cde Natural order of AMI artifacts 2017-08-24 20:57:12 +02:00
Megan Marsh 14b2d04332 make force_deregister work in all regions, not just original region. 2017-08-14 12:31:58 -07:00
Matthew Hooker 754c80d217
create default tags as well 2017-08-11 12:31:05 -07:00
cstuntz db7f860d91 Adding tagging back to spot instances, after they're created 2017-08-11 10:43:05 -07:00
Megan Marsh a924db9a79 Merge pull request #5228 from hashicorp/4653_dont_delete_snapshots
continue, not break
2017-08-08 15:07:01 -07:00
Megan Marsh ef0a091720 continue, not break 2017-08-08 14:53:56 -07:00
Matthew Hooker 968eb94b80 Merge pull request #5211 from hashicorp/4653_dont_delete_snapshots
use block device mappings to know whether a snapshot existed before p…
2017-08-08 14:31:38 -07:00
Megan Marsh 2d6028eb9a use named loops instead of doDelete flag 2017-08-08 14:28:01 -07:00
Megan Marsh e9ec705497 use block device mappings to know whether a snapshot existed before packer's current run. If yes, don't delete the unencrypted snapshot. 2017-08-08 13:59:55 -07:00
Megan Marsh c760e1323f don't panic if the communicator is none and the port is 0 2017-08-03 13:54:57 -07:00
cstuntz c717765154 Removing tagging post instance launch 2017-08-02 09:29:47 -07:00
cstuntz 42444e58e6 Updating step_run_source_instance to add tags at instance start instead of adding them to running instance 2017-07-31 11:38:30 -07:00
Megan Marsh ac15b33d2b Merge pull request #5029 from hashicorp/5007_instance_stop
add exponential backoff retry for stopping instance in amazon
2017-06-20 12:08:52 -07:00
Megan Marsh f7a703dfb2 add pending to allowable states while waiting for ebs instance to stop 2017-06-20 10:55:23 -07:00
Megan Marsh d706147423 add exponential backoff retry for stopping instance in amazon
retry only if the error is instancenotfound
2017-06-20 10:50:57 -07:00
Matthew Hooker febc65aa7c
try again to get region from metadata 2017-06-14 16:30:18 -07:00
Matthew Hooker 8dae6b60c1 Merge pull request #4996 from hashicorp/mwhooker/4613
builder/amazon: Support Assume Role with MFA and ECS Task Roles
2017-06-13 17:40:09 -07:00
Matthew Hooker 350e8bfe0d
we don't need to look for region in metadata.
Closes #4615'
2017-06-13 17:35:48 -07:00
Matthew Hooker 94d7a4ce8d
post-processor/vagrant-cloud: try upload once
* fixes multiple uploads mentioned in #4973
* removed unused token code
2017-06-12 17:34:32 -07:00
Matthew Hooker 4860d7179d
remove redundant log line 2017-06-09 13:00:08 -07:00
Constantin Bugneac ae03dab920 Print in the output the security group name too. 2017-06-09 20:05:59 +01:00
Matthew Hooker a619759bf7
add support for profile 2017-06-09 11:24:30 -07:00
Matthew Hooker 3fb4162660
remove code from bad merge 2017-06-09 11:07:29 -07:00
Matthew Hooker 624aaa2067
bugfix 2017-06-09 11:01:27 -07:00
Matthew Hooker 3ed7572525
remove cli_config 2017-06-09 10:59:50 -07:00
Matthew Hooker f637878822
with wrapping 2017-06-09 10:46:01 -07:00
Matthew Hooker 23084fe171
dedupe 2017-06-09 10:41:58 -07:00
Rickard von Essen 15f80dc5ab
aws: Drop undocumented option `profile`
This was added in 883acb18fa to support
assume role and shared configuration file. This was never completed.
2017-06-09 10:37:54 -07:00
Matthew Hooker 56c513088b
I think this was the intention 2017-06-09 10:34:49 -07:00
Matthew Hooker 94854a26d9
fix go vet issue 2017-06-09 10:30:07 -07:00
Matthew Hooker d7e39b72b2
remove dead code 2017-06-09 10:30:07 -07:00
Rickard von Essen f106e60a7e
builder/amazon: Added MFA support 2017-06-09 10:28:31 -07:00
Rickard von Essen f55c3b9d34
builder/amazon: Support assume role with assume_role_arn
This supports assuming a role when using profile or static credentials.
2017-06-09 10:27:56 -07:00
Rickard von Essen 3833d34829
builder/amazon: Cleaned up credential handeling
This properly handles:
- Preference between types of credential
- Assume role via ECS Task Role
2017-06-09 10:26:22 -07:00
Matthew Hooker 1f4b532ed5 Merge pull request #4948 from hashicorp/kms_key_regions
Kms key regions
2017-06-01 13:30:31 -07:00
Megan Marsh 875745ab9b one more test 2017-05-31 14:16:02 -07:00
Megan Marsh 1944f38985 update docs and clean up 2017-05-31 13:41:32 -07:00
Megan Marsh 5b35d199da golang has different style than python 2017-05-31 12:27:45 -07:00
Megan Marsh f9d7292566 builder/amazon regional KMS keys 2017-05-31 11:23:18 -07:00
Jason Ramey cc309c0e5f spelling fix 2017-05-26 01:03:11 -04:00
Matthew Hooker 0e3469e913
spell fix 2017-05-25 18:49:45 -07:00
Megan Marsh 7174a7a3d5 New map: region_kms_key_ids, allowing custom encryption keys on a per-region basis. Also new tests. 2017-05-25 14:42:03 -07:00
Matthew Hooker 77b4d47409
only delete snapshots which exist 2017-05-25 14:16:20 -07:00
Matthew Hooker 1cf4754d80
correct ami_name error reporting 2017-05-25 13:02:36 -07:00
Megan Marsh 4abb541468 fix logging to clarify that encrypt_boot needs to be set, not encrypt, and fix typo 2017-05-24 16:39:36 -07:00
Matthew Hooker 4137660b7a
fix ami name validation 2017-05-19 02:11:43 -07:00
Matthew Hooker ee5d13611f
update ssh client usage for new crypto/ssh version 2017-05-18 12:01:44 -07:00
Rémi Jouannet 45143bb6f4 add an option custom_endpoint_ec2 for amazon builder, add a condition if vpc_id is empty don't add the parameter to the aws call 2017-05-17 18:45:20 +02:00
Ben Fagin 6f63881020 fixes a typo introduced in a previous change 2017-05-11 13:34:48 -07:00
luis-silva a269bbc6fa Fix issue 4875 - use retry logic when creating instance tags 2017-05-11 16:25:28 +01:00
Matthew Hooker 80d6cd91fd
remove unneeded keypair var 2017-05-01 10:17:21 -07:00
Matthew Hooker 602fd64c5d
builder/amazon: set flag to delete temporary keypair 2017-04-30 14:24:22 -07:00
Matthew Hooker da8c4004f0
builder/amazon: numbers are valid in ami name 2017-04-05 12:39:16 -07:00
Matthew Hooker 3f6b5165f2
add affirmative test case for #4762 2017-04-04 22:08:09 -07:00
Craig Barr d9041bda0c Improved the test for special character so that it doesn't get halted by less than 3 character check 2017-04-05 11:06:59 +10:00
Craig Barr 7911cfa94b Formatting as per make fmt 2017-04-05 11:02:23 +10:00
Craig Barr fdae6858c8 conforming to the standard for imports 2017-04-05 10:53:58 +10:00
Craig Barr df6337e8ab Added AMIName validation (issue 4761) 2017-04-05 10:46:44 +10:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker cc11ec3566
check for a couple errors 2017-03-28 20:36:21 -07:00
Matthew Hooker 35578d9ed1
remove unnecessary type conversions 2017-03-28 20:36:21 -07:00
Matthew Hooker 79287d7e47
simplify some code 2017-03-28 20:36:20 -07:00
Matthew Hooker 0149f679de
Print instead of Printf with no dynamic first variable. 2017-03-28 20:36:20 -07:00
Matthew Hooker 230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Matthew Hooker 74c8c585f5
builder/amazon: report tag creation 2017-03-23 16:12:59 -07:00
Matthew Hooker bd76b7bb6f
builder/amazon: validate ssh key name/file
When using ssh_key_name, ssh_private_key file must be given,
or ssh_agent_auth enabled.

When automatically retrieving the winrm password, if ssh_key_name is
given, ssh_private_key_file must also be given.
2017-03-13 13:14:18 -07:00
Rickard von Essen 2300b102b7 amazon: Step Region Copy crashing on device mapping
Closes #4635
2017-03-08 18:12:37 +01:00
James Nugent e856339309 build/amazon-ebssurrogate: Add region copy, attributes, tags steps
As pointed out in the initial code review of #4351, some of the steps
from the standard EBS builder were (intetionally) omitted. It turns out
that these actually are useful, and the original rationale for the
omission was wrong. Consequently, this commit adds in the following
steps:

- `StepPrevalidate`
- `StepTagEBSVolumes`
- `StepDeregisterAMI`
- `StepCreateEncryptedAMICopy`
- `StepAMIRegionCopy`
- `StepModifyAMIAttribute`
- `StepCreateTags`

We also fix the interpolation filter and documentation to reflect these
additions, though the majority were already documented and just not
functional.
2017-02-27 09:05:39 -06:00
Matthew Hooker fd1b00a0d1
use aws helper method 2017-02-26 19:33:34 -08:00
Matthew Hooker 61976dfd86 Merge pull request #4578 from life360/enable_ena
Always set both SRIOV and ENA when Enhanced Networking is enabled
2017-02-26 19:31:22 -08:00
Matthew Hooker 6a7c37beb6
builder/amazon-chroot: support encrypted boot volume 2017-02-26 17:48:13 -08:00
Matthew Hooker 2cb9b32acf
don't attempt to delete non-existant key when using agent auth 2017-02-26 17:38:22 -08:00
Matthew Hooker f95514c120
fix ssh agent authentication
treat key name to empty string if it's not been set
by prior step.
2017-02-26 17:17:49 -08:00
Aaron Stone 1cc3cdf7b5 Always set both SRIOV and ENA when Enhanced Networking is enabled
Set SriovNetSupport to "simple". As of February 2017, this applies to C3, C4,
D2, I2, R3, and M4 (excluding m4.16xlarge).

Set EnaSupport to true. As of February 2017, this applies to C5, I3, P2, R4,
X1, and m4.16xlarge.
2017-02-25 07:16:35 -08:00
Richard Owen 33a4c2e13b Change EC2 WindowsPasswordTimeout to 20 minutes
10 minutes is often exceeded when using a custom source AMI
which has been sysprepped.
2017-02-24 11:08:17 +00:00
Rickard von Essen 6e891cf682
Fixed botched merge and review comments 2017-01-22 21:57:23 +01:00
Rickard von Essen ba9cae5078 builder/amazon: Add SourceAMI and BuildRegion template
Added {{ .SourceAMI }} and {{ .BuildRegion }} template values availible
in `ami_description`, `run_tags`, `run_volume_tags`, `tags`, and
`snapshot_tags`.
2017-01-21 20:39:58 +01:00
Matthew Hooker fc30f6cc0a
log tag creation.
closes #4427
2017-01-19 12:00:41 -08:00
Matthew Hooker 56b5e97bf4
verify given security group 2017-01-18 15:25:31 -08:00
Matthew Hooker b265d2614f
builder/amazon: fix when using security_group_id
If `security_group_id` was specified with a group that didn't exist, packer
would go into an infinite loop waiting for it. We shouldn't make assumptions
about the status of explicitely set security groups, so let's just error out
right away if we can't find it.
2017-01-18 15:11:52 -08:00
Matthew Hooker 800351b7ca
fix panic and don't print each tag we add. 2017-01-18 11:34:36 -08:00
Roman Zhuzha d9186dc8cf add proper error handling for tagging source instance 2017-01-18 14:02:10 +01:00
Roman Zhuzha a65af51a4b apply source instance default "Name" tag only if it's not provided in run_tags 2017-01-18 12:55:18 +01:00
Roman Zhuzha aa70c82ec8 use ConvertToEC2Tags to apply tags to source instance, add Say message 2017-01-18 12:50:20 +01:00
Matthew Hooker 377f451a9e
it's InvalidGroup 2017-01-05 16:56:49 -08:00
Matthew Hooker e54605c120
Properly wait for security group to exist.
Adds check for `InvalidGroupID.NotFound` in addition to
`InvalidSecurityGroupID.NotFound`.

Uses aws's `waiter` for clarity.
2017-01-05 15:20:28 -08:00
Zanetti, David ae5730c5a5 Querying EC2 security groups should report unexpected errors
As noted in #4277, we don't report any errors from the loop waiting for
a security group to exist. Instead, we should accept 'errors' which result
from the group not yet existing, and report errors which are actual issues
the user needs to resolve (eg, IAM permissions are incorrect).

Closes #4277
2016-12-21 11:45:12 +13:00
Rickard von Essen d3c2239b9e
builder/amazon: Change shutdown_behaviour to shutdown_behavior 2016-12-14 21:59:16 +01:00
Rickard von Essen c24b4423b2 builder/amazon: Added new region London - eu-west-2 2016-12-14 10:55:19 +01:00
Alexander Krasnukhin ac98aad1df Fix log statement 2016-12-13 12:53:03 +01:00
Matthew Hooker f1fb942219
add ca-central-1 to list of known aws regions.
resolves #4273
2016-12-09 11:21:44 -08:00