230 Commits

Author SHA1 Message Date
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
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
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
dfd5f07145
fix ebs acc test 2018-01-08 12:27:10 -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
f6c401a143
don't pass in accessconfig 2017-12-19 11:32:32 -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
Rickard von Essen
63f791570a
Merge pull request #5665 from kwilczynski/remove-sts-token-from-logging
amazon: Remove Session Token (STS) from being shown in the log.
2017-12-10 06:50:42 +01:00
Matthew Hooker
f216330ba3
spot instance ena/sriov checking for all other builders 2017-12-08 14:56:19 -08:00
Matthew Hooker
4b1d8e3fe8
don't allow enhanced networking flags for spot instances. 2017-12-08 13:38:49 -08:00
Krzysztof Wilczynski
05327b7524
amazon: Remove Session Token (STS) from being shown in the log.
This commit adds a change which ensures that the Session Token
config struct item is removed from log output.

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
2017-12-04 22:14:38 +01:00
John Davies-Colley
707ec675b2 ssh interface for amazon builders 🔨 2017-11-22 15:49:38 +13:00
Matthew Hooker
95e4ae251e
WIP 2017-11-02 09:03:44 -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
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
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
Zanetti, David
8a8b51be97 Allow temporary security group to have source CIDR block explicitly provided 2017-09-26 00:57:56 +00: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
14b2d04332 make force_deregister work in all regions, not just original region. 2017-08-14 12:31:58 -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
Matthew Hooker
56c513088b
I think this was the intention 2017-06-09 10:34:49 -07:00
Matthew Hooker
11ba986abc Merge pull request #4930 from hashicorp/fix4925
builder/amazon: don't try to delete extra volumes during clean up
2017-06-02 14:08:49 -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
1944f38985 update docs and clean up 2017-05-31 13:41:32 -07:00
Megan Marsh
f9d7292566 builder/amazon regional KMS keys 2017-05-31 11:23:18 -07:00
Matthew Hooker
0e3469e913
spell fix 2017-05-25 18:49:45 -07:00
Matthew Hooker
c0b27dfa6f
don't try to delete extra volumes during clean up 2017-05-25 13:48:32 -07:00
Paul Thrasher
0be5a28080 Fix issue 4693 - Derive vpc_id from subnet_id
In AWS we can derive the `VpcId` and AZ from the `SubnetId`, so now we do. In the config you can now only specify the `SubnetId`.

This fixes issue #4693.
2017-05-15 13:46:05 -07:00
Matthew Hooker
81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker
230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Matthew Hooker
50d9546658
builder/amazon: set force_deregister to true on -force 2017-03-09 14:24:49 -08: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
6a7c37beb6
builder/amazon-chroot: support encrypted boot volume 2017-02-26 17:48:13 -08: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
f5bf588393
tag all volumes 2017-01-18 11:34:46 -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
ae016a1f25 simplify code flow: skip the step if no run_volume_tags provided 2017-01-18 13:03:05 +01:00
Roman Zhuzha
36d8a1df1d use common.ConvertToEC2Tags to apply tags to source EBS volumes, change Say message 2017-01-18 12:52:59 +01:00
Matthew Hooker
c1f5545986
compress pr #4395 2017-01-13 11:42:20 -08:00
Richard Moore
9435fa62e3 Output error causing ebs volume deletion failure
When an ebs volume fails to delete, Packer reports that there
was an error deleting the volume and the volume id. But it doesn't
give you the details of what that error is. This commit adds the
error reported back to the standard output.
2017-01-13 15:33:47 +00:00
Rickard von Essen
4b1e014be8
builder/amazon: Crashes when multiple EBS vols are used
If you use a new EBS vol (which hasn't any snapshot) Packer crashes when
creating the AMI.

Closes #4303
2016-12-21 15:37:08 +01:00
Matthew Hooker
e4f6eaae9b Merge pull request #4231 from artburkart/force-delete-snapshot-patch
Fixes acceptance test for PR #4223
2016-12-17 11:43:26 -08:00
Rickard von Essen
d3c2239b9e
builder/amazon: Change shutdown_behaviour to shutdown_behavior 2016-12-14 21:59:16 +01:00