Commit Graph

568 Commits

Author SHA1 Message Date
ephemeralsnow e53f4be005 Fix 'The AssociatePublicIpAddress parameter is only supported for VPC launches.' 2016-11-24 17:01:32 +01:00
Rickard von Essen 96e9a8e6e9 Removed default value for ssh_username 2016-11-17 22:30:34 +01:00
Matthew Hooker 9a91ae4e8f
fix new session error when creating cred chain.
the old and deprecated method won't error and so is safe to use
even if we're not in amazon.
2016-11-14 11:39:22 -08:00
Matthew Hooker d81c06765d
fix go vet issue.
closes #4130
2016-11-07 10:17:53 -08:00
Matthew Hooker f3f5f89fe6 Merge pull request #4096 from mitchellh/filterday
builder/amazon-ebs: show ami id found from filter
2016-11-02 12:25:46 -07:00
Matthew Hooker 60c459d6c8 Merge pull request #4098 from mitchellh/newsession
aws-sdk: use session.NewSession
2016-11-02 12:25:14 -07:00
Matthew Hooker 9bc23ea512 Merge pull request #4099 from mitchellh/waitfail
Waitfail
2016-11-02 12:21:51 -07:00
James Nugent 36c09af992 builder/amazon: Add tests for the `ebs-volume` builder
These smoke tests are effectively a mirror of the EBS builder tests.
2016-11-02 12:56:39 -04:00
James Nugent b1ff8c3bfc builder/amazon: Add `ebs-volume` builder
This commit adds a builder that works like EBS builders, except does not
create an AMI, and instead is intended to create EBS volumes in an
initialized state. For example, the following template can be used to
create and export a set of 3 EBS Volumes in a ZFS zpool named `data` for
importing by instances running production systems:

```
{
	"variables": {
		"aws_access_key_id": "{{ env `AWS_ACCESS_KEY_ID` }}",
		"aws_secret_access_key": "{{ env `AWS_SECRET_ACCESS_KEY` }}",
		"region": "{{ env `AWS_REGION` }}",
		"source_ami": "{{ env `PACKER_SOURCE_AMI` }}",
		"vpc_id": "{{ env `PACKER_VPC_ID` }}",
		"subnet_id": "{{ env `PACKER_SUBNET_ID` }}"
	},
	"builders": [{
		"type": "amazon-ebs-volume",
		"access_key": "{{ user `aws_access_key_id` }}",
		"secret_key": "{{ user `aws_secret_access_key` }}",
		"region": "{{user `region`}}",
		"spot_price_auto_product": "Linux/UNIX (Amazon VPC)",

		"ssh_pty": true,
		"instance_type": "t2.medium",
		"vpc_id": "{{user `vpc_id` }}",
		"subnet_id": "{{user `subnet_id` }}",
		"associate_public_ip_address": true,
		"source_ami": "{{user `source_ami` }}",
		"ssh_username": "ubuntu",
		"ssh_timeout": "5m",

		"ebs_volumes": [
			{
				"device_name": "/dev/xvdf",
				"delete_on_termination": false,
				"volume_size": 10,
				"volume_type": "gp2",
				"tags": {
					"Name": "TeamCity-Data1",
					"zpool": "data",
					"Component": "TeamCity"
				}
			},
			{
				"device_name": "/dev/xvdg",
				"delete_on_termination": false,
				"volume_size": 10,
				"volume_type": "gp2",
				"tags": {
					"Name": "TeamCity-Data2",
					"zpool": "data",
					"Component": "TeamCity"
				}
			},
			{
				"device_name": "/dev/xvdh",
				"delete_on_termination": false,
				"volume_size": 10,
				"volume_type": "gp2",
				"tags": {
					"Name": "TeamCity-Data3",
					"zpool": "data",
					"Component": "TeamCity"
				}
			}
		]
	}],
	"provisioners": [
	{
		"type": "shell",
		"start_retry_timeout": "10m",
		"inline": [
			"DEBIAN_FRONTEND=noninteractive sudo apt-get update",
			"DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zfs",
			"lsblk",
			"sudo parted /dev/xvdf --script mklabel GPT",
			"sudo parted /dev/xvdg --script mklabel GPT",
			"sudo parted /dev/xvdh --script mklabel GPT",
			"sudo zpool create -m none data raidz xvdf xvdg xvdh",
			"sudo zpool status",
			"sudo zpool export data",
			"sudo zpool status"
		]
	}
	]
}
```

StepModifyInstance and StepStopInstance are now shared between EBS and
EBS-Volume builders - move them into the AWS common directory and rename
them to indicate that they only apply to EBS-backed builders.
2016-11-02 12:56:39 -04:00
Matthew Hooker d47e47cf1f rewrite to not use private aws package 2016-11-01 18:29:18 -07:00
Matthew Hooker c4c46c349e implement security group waiter 2016-11-01 18:10:42 -07:00
Matthew Hooker 970b37077e Merge pull request #4050 from jen20/ssh-agent
builder/amazon: Allow use of local SSH Agent
2016-11-01 17:27:37 -07:00
Matthew Hooker 48bdae93d1 aws-sdk: use session.NewSession 2016-11-01 15:53:04 -07:00
Matthew Hooker 83b57b98ac show ami id found from filter 2016-11-01 15:26:43 -07:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
Matthew Hooker 0dd7d7ff3b fix error message 2016-10-31 16:44:18 -07:00
Ganesh kumar Sankaran b9c6139d67 AWS async operations sometimes takes long times, if there are multiple parallel builds, polling at 2 second frequency will exceed the request limit. Allow 2 seconds to be overwritten with AWS_POLL_DELAY_SECONDS 2016-10-31 16:44:18 -07:00
Rickard von Essen d66490ebfd
Properly cleanup AWS temporary key pairs
Closes #4057 - Amazon key pair no longer cleaned up at end of build
2016-10-27 23:06:13 +02:00
Rickard von Essen d16d5d9686 Merge pull request #3817 from ChrisLundquist/dynamic-source-ami
Dynamic source ami
2016-10-25 21:24:41 +02:00
Richard Owen adddc60a1d Fix typo in encrypted ami step log message 2016-10-25 16:01:01 +01:00
James Nugent 395d88941c amazon: Allow SSH Agent auth for existing key pair
This commit allows SSH Agent authentication to be used with an existing
key pair defined in AWS.
2016-10-23 22:26:14 -05:00
James Nugent 7425fef2c7 builder/amazon: Allow use of local SSH Agent
This commit adds an option to use the local SSH Agent to authenticate
connections to source instances started by the the EBS and Instance
Store builders.

This is of use when the source AMI _already_ has configuration for
authorized SSH keys - for example if one uses an SSH certificate
authority.

A further extension (not implemented in this commit) is to allow SSH
agent use with a pre-defined key pair, in order to allow keys with
passphrases to be used without giving the passphrase to Packer.
2016-10-23 21:43:47 -05:00
Asif R Choudhury 48d94342ba Add us-east-2 (Ohio) AWS region 2016-10-17 21:31:41 -05:00
Rickard von Essen c273bd6beb Merge pull request #3789 from jeremy-asher/amazon-ebs-delete-volumes-on-failure
clean up EBS volumes on failure
2016-10-15 14:57:15 +02:00
Rickard von Essen 0be3034e82 Merge pull request #3953 from rickard-von-essen/amz-ssh
builder/amazon: Allow using ssh_private_key_file and ssh_password
2016-10-03 10:22:15 +02:00
Rickard von Essen acc2689b49
builder/amazon: Allow using ssh_private_key_file and ssh_password
This adds support for using amazon-ebs/amazon-instance builder without
a keypair. If a ssh_private_key_file is supplied without a
ssh_keypair_name no temporary ssh keypair is created. If ssh_password is
used no temporary ssh keypair is created and the password is used when
trying to connect.

Closes #2301
Closes #3156
2016-10-02 22:20:36 +02:00
Rickard von Essen cffc8e892c Merge pull request #3382 from ahamidi/encrypted-boot-volume
Create AMI with encrypted boot volume
2016-10-02 01:02:43 +02:00
Chris Lundquist 9379cbc5d9 [dynamic-source-ami] support instance builder too 2016-10-01 23:01:01 +00:00
Chris Lundquist ab3500b45c [dynamic-source-ami] support chroot builder 2016-10-01 22:56:09 +00:00
Chris Lundquist 1b4895c684 Merge remote-tracking branch 'origin/master' into dynamic-source-ami 2016-10-01 22:20:17 +00:00
Matthew Hooker a9abe43325 builder/amazon: add retry login when creating tags.
also move Retry from builder/googlecompute/common to common/retry
2016-09-28 18:22:31 -07:00
Rickard von Essen 13c9db5dd5 Merge pull request #3885 from orivej/on-error
Add -on-error command line argument to allow preserving artifacts on builder errors
2016-09-20 12:28:14 +02:00
Jeremy Asher aea05f6485 fix nil pointer dereference in amazon-chroot
The refactor of StepRegisterAmi to add the from_scratch parameter
incorrectly replaced iteration over image.BlockDeviceMappings with
iteration over the new mapping array when not using from_scratch.  This
fixes the regression and renames the parameters to newMappings and
mappings for better clarity.
2016-09-16 18:35:36 -07:00
Orivej Desh 6762965696 Add -on-error command line argument to allow preserving artifacts on builder errors
Resolves #409
2016-09-16 12:15:00 +00:00
Rickard von Essen 3b47893eb8
builder/amazon: reverted wrongly modified ssh_test's. 2016-09-14 20:26:09 +02:00
Rickard von Essen 067155c344
builder/amazon: guard aginst empty/nil PrivateIpAddress and updated tests. 2016-09-14 00:16:09 +02:00
Rickard von Essen 7f4bee737c Merge pull request #3752 from tarrall/issue3751-ssh-privateip-classic
builder/amazon: Honor ssh_private_ip flag in EC2-Classic, not just VPC
2016-09-13 22:54:00 +02:00
Rickard von Essen 120b60ae37 Merge pull request #3865 from dpiddy/amazon-ssh-retry-fix
amazon/common/ssh: fix saving of instance to state
2016-09-12 15:04:35 +02:00
Dan Peterson c7af9a67bc amazon/common/ssh: fix saving of instance to state
Fixes #3496
2016-09-09 10:16:53 -03:00
Jeremy Asher 1c392b23f9 generate warnings for unused options with from_scratch 2016-09-03 12:32:43 -07:00
Jeremy Asher ef0c7543e1 add amazon-chroot post mount commands
This adds an additional PostMountCommands step to the amazon-chroot
builder which executes after the volume is mounted, but before the
extra chroot mounts and copy step.
2016-09-03 12:32:41 -07:00
Jeremy Asher 5e8b697a76 add from_scratch option to amazon-chroot builder
This provides an alternate mode for the amazon-chroot builder which uses
a blank volume to build the image.  It adds StepPreMountCommands to
permit partitioning and format commands to be executed before mounting
the new volume.
2016-09-03 12:28:22 -07:00
Jeremy Asher 85ae04bb75 split up BlockDevices in amazon/common
This breaks up the two options provided by BlockDevices into separate
structs to allow only one of them to be used by the amazon-chroot
builder.
2016-09-03 09:58:45 -07:00
Chris Lundquist defdd1ecf3 Merge remote-tracking branch 'origin/master' into dynamic-source-ami 2016-09-02 01:43:03 +00:00
Rickard von Essen ba629922c6 Merge pull request #3662 from ryansb/boost-spot-bid
(AWS Spot) Add 0.5 cents to discovered spot price
2016-08-27 03:18:59 +02:00
Krzysztof Wilczynski d01fb65dcf Fix. Use temporary_key_pair_name when specified. (#3739)
Fix: Use temporary_key_pair_name when specified.

This is to fix an issue where the temporary_key_pair_name configuration option
for amazon-ebs and amazon-instance builders would be ignored and replaced with
an automatically generated value using UUID, even when the option was explicitly
specified.

Remove space from the auto-generated SSH key-pair name.

Resolves #3736
2016-08-25 09:17:57 +02:00
Chris Lundquist 3cc8d35450 [dynamic-source-ami] fix old key name in error message 2016-08-21 00:58:01 +00:00
Chris Lundquist b4d20706ce [dynamic-source-ami] add some very basic tests 2016-08-21 00:29:51 +00:00
Chris Lundquist 57e7a1a3e6 [dynamic-source-ami] fix lint error 2016-08-21 00:07:58 +00:00
Chris Lundquist 95afaa58ca [dynamic-source-ami] rename to source_ami_filter 2016-08-20 23:34:22 +00:00