From f01346d305a670bb01f2dce506acb87e320c08d8 Mon Sep 17 00:00:00 2001 From: ktruong7 Date: Thu, 7 Nov 2013 11:13:52 -0500 Subject: [PATCH 01/40] Added a description field for the vmware builder that is written to the vm after a build --- builder/vmware/builder.go | 5 +++++ builder/vmware/builder_test.go | 28 ++++++++++++++++++++++++++++ builder/vmware/step_create_vmx.go | 2 ++ 3 files changed, 35 insertions(+) diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index f75014459..47bbcd124 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -54,6 +54,7 @@ type config struct { VMXTemplatePath string `mapstructure:"vmx_template_path"` VNCPortMin uint `mapstructure:"vnc_port_min"` VNCPortMax uint `mapstructure:"vnc_port_max"` + Description string `mapstructure:"description"` RawBootWait string `mapstructure:"boot_wait"` RawSingleISOUrl string `mapstructure:"iso_url"` @@ -138,6 +139,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { if b.config.ToolsUploadPath == "" { b.config.ToolsUploadPath = "{{ .Flavor }}.iso" } + + if b.config.Description == "" { + b.config.Description = "" + } // Errors templates := map[string]*string{ diff --git a/builder/vmware/builder_test.go b/builder/vmware/builder_test.go index 893970768..b13d114c7 100644 --- a/builder/vmware/builder_test.go +++ b/builder/vmware/builder_test.go @@ -744,6 +744,34 @@ func TestBuilderPrepare_VNCPort(t *testing.T) { } } +func TestBuilderPrepare_Description(t *testing.T) { + var b Builder + config := testConfig() + + // Test with no description field + config["description"] = "" + warns, err := b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if err != nil { + t.Fatalf("err: %s", err) + } + if b.config.Description != "" { + t.Fatalf("Wrong value: %s", b.config.Description) + } + + // Test with a description field + config["description"] = "VM description" + warns, err = b.Prepare(config) + if len(warns) > 0 { + t.Fatalf("bad: %#v", warns) + } + if b.config.Description != "VM description" { + t.Fatalf("Wrong value: %s", b.config.Description) + } +} + func TestBuilderPrepare_VMXData(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/vmware/step_create_vmx.go b/builder/vmware/step_create_vmx.go index e2f7c028a..9f873b46e 100644 --- a/builder/vmware/step_create_vmx.go +++ b/builder/vmware/step_create_vmx.go @@ -90,6 +90,8 @@ func (stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction { // Set this so that no dialogs ever appear from Packer. vmxData["msg.autoAnswer"] = "true" + // prints the template description into the "notes" field on VMWare + vmxData["annotation"] = config.Description vmxPath := filepath.Join(config.OutputDir, config.VMName+".vmx") if err := WriteVMX(vmxPath, vmxData); err != nil { From f41915d2915f3cdb4f2582dcb0c606a131455d70 Mon Sep 17 00:00:00 2001 From: ktruong7 Date: Thu, 7 Nov 2013 11:22:24 -0500 Subject: [PATCH 02/40] update --- builder/vmware/builder.go | 5 ----- builder/vmware/builder_test.go | 28 ---------------------------- builder/vmware/step_create_vmx.go | 2 -- 3 files changed, 35 deletions(-) diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index 47bbcd124..f75014459 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -54,7 +54,6 @@ type config struct { VMXTemplatePath string `mapstructure:"vmx_template_path"` VNCPortMin uint `mapstructure:"vnc_port_min"` VNCPortMax uint `mapstructure:"vnc_port_max"` - Description string `mapstructure:"description"` RawBootWait string `mapstructure:"boot_wait"` RawSingleISOUrl string `mapstructure:"iso_url"` @@ -139,10 +138,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { if b.config.ToolsUploadPath == "" { b.config.ToolsUploadPath = "{{ .Flavor }}.iso" } - - if b.config.Description == "" { - b.config.Description = "" - } // Errors templates := map[string]*string{ diff --git a/builder/vmware/builder_test.go b/builder/vmware/builder_test.go index b13d114c7..893970768 100644 --- a/builder/vmware/builder_test.go +++ b/builder/vmware/builder_test.go @@ -744,34 +744,6 @@ func TestBuilderPrepare_VNCPort(t *testing.T) { } } -func TestBuilderPrepare_Description(t *testing.T) { - var b Builder - config := testConfig() - - // Test with no description field - config["description"] = "" - warns, err := b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if err != nil { - t.Fatalf("err: %s", err) - } - if b.config.Description != "" { - t.Fatalf("Wrong value: %s", b.config.Description) - } - - // Test with a description field - config["description"] = "VM description" - warns, err = b.Prepare(config) - if len(warns) > 0 { - t.Fatalf("bad: %#v", warns) - } - if b.config.Description != "VM description" { - t.Fatalf("Wrong value: %s", b.config.Description) - } -} - func TestBuilderPrepare_VMXData(t *testing.T) { var b Builder config := testConfig() diff --git a/builder/vmware/step_create_vmx.go b/builder/vmware/step_create_vmx.go index 9f873b46e..e2f7c028a 100644 --- a/builder/vmware/step_create_vmx.go +++ b/builder/vmware/step_create_vmx.go @@ -90,8 +90,6 @@ func (stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction { // Set this so that no dialogs ever appear from Packer. vmxData["msg.autoAnswer"] = "true" - // prints the template description into the "notes" field on VMWare - vmxData["annotation"] = config.Description vmxPath := filepath.Join(config.OutputDir, config.VMName+".vmx") if err := WriteVMX(vmxPath, vmxData); err != nil { From 817b1bdb32abf18e5b05a9fce78a2c756f2ad6e9 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 19 Nov 2013 12:03:35 -0500 Subject: [PATCH 03/40] Add ProxyUrl parameter for OpenStack builder. In my particular case I need to use a separate HTTP proxy to access my OpenStack API than what is set in the environment. This commit adds an optional parameter to the builder configuration and overrides the net/http client that is used by the gophercloud library. --- builder/openstack/access_config.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/builder/openstack/access_config.go b/builder/openstack/access_config.go index 82fcee185..947e58854 100644 --- a/builder/openstack/access_config.go +++ b/builder/openstack/access_config.go @@ -4,6 +4,8 @@ import ( "fmt" "github.com/mitchellh/packer/packer" "github.com/rackspace/gophercloud" + "net/http" + "net/url" "os" ) @@ -14,6 +16,7 @@ type AccessConfig struct { Project string `mapstructure:"project"` Provider string `mapstructure:"provider"` RawRegion string `mapstructure:"region"` + ProxyUrl string `mapstructure:"proxy_url"` } // Auth returns a valid Auth object for access to openstack services, or @@ -23,6 +26,7 @@ func (c *AccessConfig) Auth() (gophercloud.AccessProvider, error) { password := c.Password project := c.Project provider := c.Provider + proxy := c.ProxyUrl if username == "" { username = os.Getenv("SDK_USERNAME") @@ -47,6 +51,19 @@ func (c *AccessConfig) Auth() (gophercloud.AccessProvider, error) { authoptions.TenantName = project } + // For corporate networks it may be the case where we want our API calls + // to be sent through a separate HTTP proxy than external traffic. + if proxy != "" { + url, err := url.Parse(proxy) + if err != nil { + return nil, err + } + + // The gophercloud.Context has a UseCustomClient method which + // would allow us to override with a new instance of http.Client. + http.DefaultTransport = &http.Transport{Proxy: http.ProxyURL(url)} + } + return gophercloud.Authenticate(provider, authoptions) } From e3af0ead2987e7a7fe3c9c04620f2ad779abafe9 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Tue, 19 Nov 2013 17:22:17 -0500 Subject: [PATCH 04/40] Website: Update timeout to reflect real default. The default in the actual code is 5m. --- website/source/docs/builders/openstack.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/builders/openstack.html.markdown b/website/source/docs/builders/openstack.html.markdown index 441f8a7c9..a9644367b 100644 --- a/website/source/docs/builders/openstack.html.markdown +++ b/website/source/docs/builders/openstack.html.markdown @@ -59,7 +59,7 @@ Optional: * `ssh_timeout` (string) - The time to wait for SSH to become available before timing out. The format of this value is a duration such as "5s" - or "5m". The default SSH timeout is "1m". + or "1m". The default SSH timeout is "5m". * `ssh_username` (string) - The username to use in order to communicate over SSH to the running server. The default is "root". From 9cabad470439a1f27742bc1b6c5cf24a078f933e Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Mon, 25 Nov 2013 13:27:38 +0100 Subject: [PATCH 05/40] website: move iam policy documentation to the root amazon page --- .../docs/builders/amazon-chroot.html.markdown | 37 ------------------- .../source/docs/builders/amazon.html.markdown | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/website/source/docs/builders/amazon-chroot.html.markdown b/website/source/docs/builders/amazon-chroot.html.markdown index 3ea0e456c..a1ef7a0ae 100644 --- a/website/source/docs/builders/amazon-chroot.html.markdown +++ b/website/source/docs/builders/amazon-chroot.html.markdown @@ -210,40 +210,3 @@ prevent packages installed by your provisioners from starting services: ] } - -## Using an IAM Instance Profile - -If AWS keys are not specified in the template or through environment variables -Packer will use credentials provided by the instance's IAM profile, if it has one. - -The following policy document provides the minimal set permissions necessary for Packer to work: - -
-{
-  "Statement": [{
-      "Effect": "Allow",
-      "Action" : [
-        "ec2:AttachVolume",
-        "ec2:CreateVolume",
-        "ec2:DeleteVolume",
-        "ec2:DescribeVolumes",
-        "ec2:DetachVolume",
-
-        "ec2:DescribeInstances",
-
-        "ec2:CreateSnapshot",
-        "ec2:DeleteSnapshot",
-        "ec2:DescribeSnapshots",
-
-        "ec2:DescribeImages",
-        "ec2:RegisterImage",
-
-        "ec2:CreateTags"
-      ],
-      "Resource" : "*"
-  }]
-}
-
- -Depending on what setting you use the following Actions might have to be allowed as well: -* `ec2:ModifyImageAttribute` when using `ami_description` diff --git a/website/source/docs/builders/amazon.html.markdown b/website/source/docs/builders/amazon.html.markdown index 604f2489a..e4e15f886 100644 --- a/website/source/docs/builders/amazon.html.markdown +++ b/website/source/docs/builders/amazon.html.markdown @@ -30,3 +30,40 @@ AMI. Packer supports the following builders at the moment: amazon-ebs builder. It is much easier to use and Amazon generally recommends EBS-backed images nowadays. + +## Using an IAM Instance Profile + +If AWS keys are not specified in the template or through environment variables +Packer will use credentials provided by the instance's IAM profile, if it has one. + +The following policy document provides the minimal set permissions necessary for Packer to work: + +
+{
+  "Statement": [{
+      "Effect": "Allow",
+      "Action" : [
+        "ec2:AttachVolume",
+        "ec2:CreateVolume",
+        "ec2:DeleteVolume",
+        "ec2:DescribeVolumes",
+        "ec2:DetachVolume",
+
+        "ec2:DescribeInstances",
+
+        "ec2:CreateSnapshot",
+        "ec2:DeleteSnapshot",
+        "ec2:DescribeSnapshots",
+
+        "ec2:DescribeImages",
+        "ec2:RegisterImage",
+
+        "ec2:CreateTags"
+      ],
+      "Resource" : "*"
+  }]
+}
+
+ +Depending on what setting you use the following Actions might have to be allowed as well: +* `ec2:ModifyImageAttribute` when using `ami_description` From 5c1f9e4cd3ecfa650f2d6cb2aaa57a89b576f632 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Mon, 25 Nov 2013 13:36:32 +0100 Subject: [PATCH 06/40] website: use user variables in the intro (ec2) --- .../getting-started/build-image.html.markdown | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/website/source/intro/getting-started/build-image.html.markdown b/website/source/intro/getting-started/build-image.html.markdown index 7e91de208..e37f56664 100644 --- a/website/source/intro/getting-started/build-image.html.markdown +++ b/website/source/intro/getting-started/build-image.html.markdown @@ -46,10 +46,14 @@ briefly. Create a file `example.json` and fill it with the following contents:
 {
+  "variables": {
+    "aws_access_key": "",
+    "aws_secret_key": ""
+  },
   "builders": [{
     "type": "amazon-ebs",
-    "access_key": "YOUR KEY HERE",
-    "secret_key": "YOUR SECRET KEY HERE",
+    "access_key": "{{user `aws_access_key`}}",
+    "secret_key": "{{user `aws_secret_key`}}",
     "region": "us-east-1",
     "source_ami": "ami-de0d9eb7",
     "instance_type": "t1.micro",
@@ -59,9 +63,11 @@ briefly. Create a file `example.json` and fill it with the following contents:
 }
 
-Please fill in the `access_key` and `secret_key` with the proper values -for your account. Your security credentials can be found on -[this page](https://console.aws.amazon.com/iam/home?#security_credential). +When building, you'll pass in the `aws_access_key` and `aws_access_key` as +a [user variable](/docs/templates/user-variables.html), keeping your secret +keys out of the template. You can create security credentials +on [this page](https://console.aws.amazon.com/iam/home?#security_credential). +An example IAM policy document can be found in the [Amazon EC2 builder docs](/docs/builders/amazon.html). This is a basic template that is ready-to-go. It should be immediately recognizable as a normal, basic JSON object. Within the object, the `builders` section @@ -106,7 +112,10 @@ should look similar to below. Note that this process typically takes a few minutes. ``` -$ packer build example.json +$ packer build \ + -var 'aws_access_key=YOUR ACCESS KEY' \ + -var 'aws_secret_key=YOUR SECRET KEY' \ + example.json ==> amazon-ebs: amazon-ebs output will be in this color. ==> amazon-ebs: Creating temporary keypair for this instance... From 2da4af816641d9c33351b7a3583747ee3ba92cc2 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Mon, 25 Nov 2013 13:47:23 +0100 Subject: [PATCH 07/40] website: user user varibles in the intro (parallel builds) --- .../parallel-builds.html.markdown | 27 ++++++++++++++----- .../getting-started/provision.html.markdown | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/website/source/intro/getting-started/parallel-builds.html.markdown b/website/source/intro/getting-started/parallel-builds.html.markdown index 2a5b422f8..c53dfd249 100644 --- a/website/source/intro/getting-started/parallel-builds.html.markdown +++ b/website/source/intro/getting-started/parallel-builds.html.markdown @@ -63,13 +63,23 @@ array.
 {
   "type": "digitalocean",
-  "api_key": "INSERT API KEY HERE",
-  "client_id": "INSERT CLIENT ID HERE"
+  "api_key": "{{user `do_api_key`}}",
+  "client_id": "{{user `do_client_id`}}"
 }
 
-Fill in your `api_key` and `client_id` for DigitalOcean as necessary. -The entire template should now [look like this](https://gist.github.com/mitchellh/51a447e38e7e496eb29c). +You'll also need to modify the `variables` section of the template +to include the access keys for DigitalOcean. + +
+"variables": {
+  ...
+  "do_api_key": "",
+  "do_client_id": ""
+}
+
+ +The entire template should now [look like this](https://gist.github.com/pearkes/cc5f8505eee5403a43a6). Additional builders are simply added to the `builders` array in the template. This tells Packer to build multiple images. The builder `type` values don't @@ -87,13 +97,18 @@ manual that contains a listing of all the available configuration options. ## Build -Now run `packer build example.json`. The output is too verbose to include +Now run `packer build` with your user variables. The output is too verbose to include all of it, but a portion of it is reproduced below. Note that the ordering and wording of the lines may be slightly different, but the effect is the same. ``` -$ packer build example.json +$ packer build \ + -var 'aws_access_key=YOUR ACCESS KEY' \ + -var 'aws_secret_key=YOUR SECRET KEY' \ + -var 'do_api_key=YOUR API KEY' \ + -var 'do_client_id=YOUR CLIENT ID' \ + example.json ==> amazon-ebs: amazon-ebs output will be in this color. ==> digitalocean: digitalocean output will be in this color. diff --git a/website/source/intro/getting-started/provision.html.markdown b/website/source/intro/getting-started/provision.html.markdown index fa6016744..4276ae089 100644 --- a/website/source/intro/getting-started/provision.html.markdown +++ b/website/source/intro/getting-started/provision.html.markdown @@ -37,6 +37,7 @@ block below.
 {
+  "variables": [...],
   "builders": [...],
 
   "provisioners": [{

From 3591e35617dad1f352d8eb99ad1977979c5afe79 Mon Sep 17 00:00:00 2001
From: Jack Pearkes 
Date: Mon, 25 Nov 2013 13:51:32 +0100
Subject: [PATCH 08/40] website: prettyprint variables examle in parallel
 builds

---
 .../source/intro/getting-started/parallel-builds.html.markdown  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/website/source/intro/getting-started/parallel-builds.html.markdown b/website/source/intro/getting-started/parallel-builds.html.markdown
index c53dfd249..e51311214 100644
--- a/website/source/intro/getting-started/parallel-builds.html.markdown
+++ b/website/source/intro/getting-started/parallel-builds.html.markdown
@@ -71,7 +71,7 @@ array.
 You'll also need to modify the `variables` section of the template
 to include the access keys for DigitalOcean.
 
-
+
 "variables": {
   ...
   "do_api_key": "",

From 31bf1f342c18a83b5c02a4ac5039e39628548211 Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 11:32:08 +1000
Subject: [PATCH 09/40] https://github.com/mitchellh/packer/issues/578

---
 builder/amazon/common/run_config.go           | 48 ++++++++++---------
 .../amazon/common/step_run_source_instance.go | 44 +++++++++--------
 builder/amazon/ebs/builder.go                 | 21 ++++----
 builder/amazon/instance/builder.go            | 21 ++++----
 4 files changed, 70 insertions(+), 64 deletions(-)

diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index 208266518..74ce76cb1 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -11,20 +11,21 @@ import (
 // RunConfig contains configuration for running an instance from a source
 // AMI and details on how to access that launched image.
 type RunConfig struct {
-	SourceAmi            string   `mapstructure:"source_ami"`
-	IamInstanceProfile   string   `mapstructure:"iam_instance_profile"`
-	InstanceType         string   `mapstructure:"instance_type"`
-	UserData             string   `mapstructure:"user_data"`
-	UserDataFile         string   `mapstructure:"user_data_file"`
-	RawSSHTimeout        string   `mapstructure:"ssh_timeout"`
-	SSHUsername          string   `mapstructure:"ssh_username"`
-	SSHPort              int      `mapstructure:"ssh_port"`
-	SecurityGroupId      string   `mapstructure:"security_group_id"`
-	SecurityGroupIds     []string `mapstructure:"security_group_ids"`
-	SubnetId             string   `mapstructure:"subnet_id"`
-	TemporaryKeyPairName string   `mapstructure:"temporary_key_pair_name"`
-	VpcId                string   `mapstructure:"vpc_id"`
-	AvailabilityZone     string   `mapstructure:"availability_zone"`
+	SourceAmi                string   `mapstructure:"source_ami"`
+	IamInstanceProfile       string   `mapstructure:"iam_instance_profile"`
+	InstanceType             string   `mapstructure:"instance_type"`
+	UserData                 string   `mapstructure:"user_data"`
+	UserDataFile             string   `mapstructure:"user_data_file"`
+	RawSSHTimeout            string   `mapstructure:"ssh_timeout"`
+	SSHUsername              string   `mapstructure:"ssh_username"`
+	SSHPort                  int      `mapstructure:"ssh_port"`
+	SecurityGroupId          string   `mapstructure:"security_group_id"`
+	SecurityGroupIds         []string `mapstructure:"security_group_ids"`
+	SubnetId                 string   `mapstructure:"subnet_id"`
+	AssociatePublicIpAddress bool     `mapstructure:"associate_public_ip_address"`
+	TemporaryKeyPairName     string   `mapstructure:"temporary_key_pair_name"`
+	VpcId                    string   `mapstructure:"vpc_id"`
+	AvailabilityZone         string   `mapstructure:"availability_zone"`
 
 	// Unexported fields that are calculated from others
 	sshTimeout time.Duration
@@ -85,15 +86,16 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
 	}
 
 	templates := map[string]*string{
-		"iam_instance_profile":    &c.IamInstanceProfile,
-		"instance_type":           &c.InstanceType,
-		"ssh_timeout":             &c.RawSSHTimeout,
-		"ssh_username":            &c.SSHUsername,
-		"source_ami":              &c.SourceAmi,
-		"subnet_id":               &c.SubnetId,
-		"temporary_key_pair_name": &c.TemporaryKeyPairName,
-		"vpc_id":                  &c.VpcId,
-		"availability_zone":       &c.AvailabilityZone,
+		"iam_instance_profile":        &cc.IamInstanceProfile,
+		"instance_type":               &cc.InstanceType,
+		"ssh_timeout":                 &cc.RawSSHTimeout,
+		"ssh_username":                &cc.SSHUsername,
+		"source_ami":                  &cc.SourceAmi,
+		"subnet_id":                   &cc.SubnetId,
+		"associate_public_ip_address": &cc.AssociatePublicIpAddress,
+		"temporary_key_pair_name":     &cc.TemporaryKeyPairName,
+		"vpc_id":                      &cc.VpcId,
+		"availability_zone":           &cc.AvailabilityZone,
 	}
 
 	for n, ptr := range templates {
diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index 9d92c226c..a122318c4 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -10,16 +10,17 @@ import (
 )
 
 type StepRunSourceInstance struct {
-	Debug              bool
-	ExpectedRootDevice string
-	InstanceType       string
-	UserData           string
-	UserDataFile       string
-	SourceAMI          string
-	IamInstanceProfile string
-	SubnetId           string
-	AvailabilityZone   string
-	BlockDevices       BlockDevices
+	Debug                    bool
+	ExpectedRootDevice       string
+	InstanceType             string
+	UserData                 string
+	UserDataFile             string
+	SourceAMI                string
+	IamInstanceProfile       string
+	SubnetId                 string
+	AssociatePublicIpAddress bool
+	AvailabilityZone         string
+	BlockDevices             BlockDevices
 
 	instance *ec2.Instance
 }
@@ -47,17 +48,18 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
 	}
 
 	runOpts := &ec2.RunInstances{
-		KeyName:            keyName,
-		ImageId:            s.SourceAMI,
-		InstanceType:       s.InstanceType,
-		UserData:           []byte(userData),
-		MinCount:           0,
-		MaxCount:           0,
-		SecurityGroups:     securityGroups,
-		IamInstanceProfile: s.IamInstanceProfile,
-		SubnetId:           s.SubnetId,
-		BlockDevices:       s.BlockDevices.BuildLaunchDevices(),
-		AvailZone:          s.AvailabilityZone,
+		KeyName:                  keyName,
+		ImageId:                  s.SourceAMI,
+		InstanceType:             s.InstanceType,
+		UserData:                 []byte(userData),
+		MinCount:                 0,
+		MaxCount:                 0,
+		SecurityGroups:           securityGroups,
+		IamInstanceProfile:       s.IamInstanceProfile,
+		SubnetId:                 s.SubnetId,
+		AssociatePublicIpAddress: s.AssociatePublicIpAddress,
+		BlockDevices:             s.BlockDevices.BuildLaunchDevices(),
+		AvailZone:                s.AvailabilityZone,
 	}
 
 	ui.Say("Launching a source AWS instance...")
diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go
index 5d68f9470..e58392f84 100644
--- a/builder/amazon/ebs/builder.go
+++ b/builder/amazon/ebs/builder.go
@@ -93,16 +93,17 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			VpcId:            b.config.VpcId,
 		},
 		&awscommon.StepRunSourceInstance{
-			Debug:              b.config.PackerDebug,
-			ExpectedRootDevice: "ebs",
-			InstanceType:       b.config.InstanceType,
-			UserData:           b.config.UserData,
-			UserDataFile:       b.config.UserDataFile,
-			SourceAMI:          b.config.SourceAmi,
-			IamInstanceProfile: b.config.IamInstanceProfile,
-			SubnetId:           b.config.SubnetId,
-			AvailabilityZone:   b.config.AvailabilityZone,
-			BlockDevices:       b.config.BlockDevices,
+			Debug:                    b.config.PackerDebug,
+			ExpectedRootDevice:       "ebs",
+			InstanceType:             b.config.InstanceType,
+			UserData:                 b.config.UserData,
+			UserDataFile:             b.config.UserDataFile,
+			SourceAMI:                b.config.SourceAmi,
+			IamInstanceProfile:       b.config.IamInstanceProfile,
+			SubnetId:                 b.config.SubnetId,
+			AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
+			AvailabilityZone:         b.config.AvailabilityZone,
+			BlockDevices:             b.config.BlockDevices,
 		},
 		&common.StepConnectSSH{
 			SSHAddress:     awscommon.SSHAddress(ec2conn, b.config.SSHPort),
diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index 455a7cd01..bb655e629 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -196,16 +196,17 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			VpcId:            b.config.VpcId,
 		},
 		&awscommon.StepRunSourceInstance{
-			Debug:              b.config.PackerDebug,
-			ExpectedRootDevice: "instance-store",
-			InstanceType:       b.config.InstanceType,
-			IamInstanceProfile: b.config.IamInstanceProfile,
-			UserData:           b.config.UserData,
-			UserDataFile:       b.config.UserDataFile,
-			SourceAMI:          b.config.SourceAmi,
-			SubnetId:           b.config.SubnetId,
-			AvailabilityZone:   b.config.AvailabilityZone,
-			BlockDevices:       b.config.BlockDevices,
+			Debug:                    b.config.PackerDebug,
+			ExpectedRootDevice:       "instance-store",
+			InstanceType:             b.config.InstanceType,
+			IamInstanceProfile:       b.config.IamInstanceProfile,
+			UserData:                 b.config.UserData,
+			UserDataFile:             b.config.UserDataFile,
+			SourceAMI:                b.config.SourceAmi,
+			SubnetId:                 b.config.SubnetId,
+			AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
+			AvailabilityZone:         b.config.AvailabilityZone,
+			BlockDevices:             b.config.BlockDevices,
 		},
 		&common.StepConnectSSH{
 			SSHAddress:     awscommon.SSHAddress(ec2conn, b.config.SSHPort),

From abaacb0683803cbf415e466ee213d94db0ab84da Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 11:41:39 +1000
Subject: [PATCH 10/40] docs update for
 https://github.com/mitchellh/packer/issues/578

---
 website/source/docs/builders/amazon-ebs.html.markdown      | 4 ++++
 website/source/docs/builders/amazon-instance.html.markdown | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/website/source/docs/builders/amazon-ebs.html.markdown b/website/source/docs/builders/amazon-ebs.html.markdown
index a050314a0..96177bfb9 100644
--- a/website/source/docs/builders/amazon-ebs.html.markdown
+++ b/website/source/docs/builders/amazon-ebs.html.markdown
@@ -111,6 +111,10 @@ Optional:
 * `subnet_id` (string) - If using VPC, the ID of the subnet, such as
   "subnet-12345def", where Packer will launch the EC2 instance.
 
+* `associate_public_ip_address` (bool) - If using a non-default VPC, public
+  IP addresses are not provided by default. If this is toggled, your new
+	instance will get a Public IP.
+
 * `tags` (object of key/value strings) - Tags applied to the AMI.
 
 * `user_data` (string) - User data to apply when launching the instance.
diff --git a/website/source/docs/builders/amazon-instance.html.markdown b/website/source/docs/builders/amazon-instance.html.markdown
index b2caf1371..3135bf322 100644
--- a/website/source/docs/builders/amazon-instance.html.markdown
+++ b/website/source/docs/builders/amazon-instance.html.markdown
@@ -150,6 +150,10 @@ Optional:
 * `subnet_id` (string) - If using VPC, the ID of the subnet, such as
   "subnet-12345def", where Packer will launch the EC2 instance.
 
+* `associate_public_ip_address` (bool) - If using a non-default VPC, public
+  IP addresses are not provided by default. If this is toggled, your new
+	instance will get a Public IP.
+
 * `tags` (object of key/value strings) - Tags applied to the AMI.
 
 * `user_data` (string) - User data to apply when launching the instance.

From 5df7bc0acf5b3db3188585224c42af402a9ab5c9 Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 12:05:37 +1000
Subject: [PATCH 11/40] oops bugfix for work on
 https://github.com/mitchellh/packer/issues/578

---
 builder/amazon/common/run_config.go | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index 74ce76cb1..d8b195b43 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -86,16 +86,16 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
 	}
 
 	templates := map[string]*string{
-		"iam_instance_profile":        &cc.IamInstanceProfile,
-		"instance_type":               &cc.InstanceType,
-		"ssh_timeout":                 &cc.RawSSHTimeout,
-		"ssh_username":                &cc.SSHUsername,
-		"source_ami":                  &cc.SourceAmi,
-		"subnet_id":                   &cc.SubnetId,
-		"associate_public_ip_address": &cc.AssociatePublicIpAddress,
-		"temporary_key_pair_name":     &cc.TemporaryKeyPairName,
-		"vpc_id":                      &cc.VpcId,
-		"availability_zone":           &cc.AvailabilityZone,
+		"iam_instance_profile":        &c.IamInstanceProfile,
+		"instance_type":               &c.InstanceType,
+		"ssh_timeout":                 &c.RawSSHTimeout,
+		"ssh_username":                &c.SSHUsername,
+		"source_ami":                  &c.SourceAmi,
+		"subnet_id":                   &c.SubnetId,
+		"associate_public_ip_address": &c.AssociatePublicIpAddress,
+		"temporary_key_pair_name":     &c.TemporaryKeyPairName,
+		"vpc_id":                      &c.VpcId,
+		"availability_zone":           &c.AvailabilityZone,
 	}
 
 	for n, ptr := range templates {

From 0cfb7564d58e5c2169e5427509fa29c8a0a01186 Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 13:44:39 +1000
Subject: [PATCH 12/40] lets try a string instead of a bool for
 AssociatePublicIpAddress

---
 builder/amazon/chroot/builder.go                    | 2 +-
 builder/amazon/chroot/step_attach_volume.go         | 2 +-
 builder/amazon/chroot/step_create_volume.go         | 2 +-
 builder/amazon/chroot/step_instance_info.go         | 4 ++--
 builder/amazon/chroot/step_register_ami.go          | 2 +-
 builder/amazon/chroot/step_snapshot.go              | 2 +-
 builder/amazon/chroot/step_source_ami_info.go       | 2 +-
 builder/amazon/common/access_config.go              | 2 +-
 builder/amazon/common/ami_config.go                 | 2 +-
 builder/amazon/common/artifact.go                   | 4 ++--
 builder/amazon/common/block_device.go               | 2 +-
 builder/amazon/common/block_device_test.go          | 2 +-
 builder/amazon/common/run_config.go                 | 2 +-
 builder/amazon/common/ssh.go                        | 2 +-
 builder/amazon/common/state.go                      | 2 +-
 builder/amazon/common/step_ami_region_copy.go       | 4 ++--
 builder/amazon/common/step_create_tags.go           | 4 ++--
 builder/amazon/common/step_key_pair.go              | 2 +-
 builder/amazon/common/step_modify_ami_attributes.go | 4 ++--
 builder/amazon/common/step_run_source_instance.go   | 4 ++--
 builder/amazon/common/step_security_group.go        | 2 +-
 builder/amazon/ebs/builder.go                       | 2 +-
 builder/amazon/ebs/step_create_ami.go               | 2 +-
 builder/amazon/ebs/step_stop_instance.go            | 2 +-
 builder/amazon/instance/builder.go                  | 2 +-
 builder/amazon/instance/step_bundle_volume.go       | 2 +-
 builder/amazon/instance/step_register_ami.go        | 2 +-
 27 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go
index e898f4173..0be428f07 100644
--- a/builder/amazon/chroot/builder.go
+++ b/builder/amazon/chroot/builder.go
@@ -7,7 +7,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/chroot/step_attach_volume.go b/builder/amazon/chroot/step_attach_volume.go
index ab2ddb708..6c5f06c57 100644
--- a/builder/amazon/chroot/step_attach_volume.go
+++ b/builder/amazon/chroot/step_attach_volume.go
@@ -3,7 +3,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_create_volume.go b/builder/amazon/chroot/step_create_volume.go
index 0b89cf642..e5e8e43cf 100644
--- a/builder/amazon/chroot/step_create_volume.go
+++ b/builder/amazon/chroot/step_create_volume.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_instance_info.go b/builder/amazon/chroot/step_instance_info.go
index cb694cc07..ca991e130 100644
--- a/builder/amazon/chroot/step_instance_info.go
+++ b/builder/amazon/chroot/step_instance_info.go
@@ -2,8 +2,8 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/aws"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"log"
diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go
index cb52b646c..e4d5a7b1d 100644
--- a/builder/amazon/chroot/step_register_ami.go
+++ b/builder/amazon/chroot/step_register_ami.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_snapshot.go b/builder/amazon/chroot/step_snapshot.go
index e065da2df..c5c92d772 100644
--- a/builder/amazon/chroot/step_snapshot.go
+++ b/builder/amazon/chroot/step_snapshot.go
@@ -3,7 +3,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_source_ami_info.go b/builder/amazon/chroot/step_source_ami_info.go
index 32ca5fd9c..c2b5022df 100644
--- a/builder/amazon/chroot/step_source_ami_info.go
+++ b/builder/amazon/chroot/step_source_ami_info.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go
index 1690869d0..5fbf66173 100644
--- a/builder/amazon/common/access_config.go
+++ b/builder/amazon/common/access_config.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
+	"github.com/CpuID/goamz/aws"
 	"github.com/mitchellh/packer/packer"
 	"strings"
 	"unicode"
diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go
index 50e831c9d..58b1aacf0 100644
--- a/builder/amazon/common/ami_config.go
+++ b/builder/amazon/common/ami_config.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
+	"github.com/CpuID/goamz/aws"
 	"github.com/mitchellh/packer/packer"
 )
 
diff --git a/builder/amazon/common/artifact.go b/builder/amazon/common/artifact.go
index 3913833d7..c85b7f50d 100644
--- a/builder/amazon/common/artifact.go
+++ b/builder/amazon/common/artifact.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/aws"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/packer/packer"
 	"log"
 	"strings"
diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go
index 08f07e269..81d7ee3e2 100644
--- a/builder/amazon/common/block_device.go
+++ b/builder/amazon/common/block_device.go
@@ -1,7 +1,7 @@
 package common
 
 import (
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 )
 
 // BlockDevice
diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go
index 2e671e3d6..a66ae0f84 100644
--- a/builder/amazon/common/block_device_test.go
+++ b/builder/amazon/common/block_device_test.go
@@ -1,7 +1,7 @@
 package common
 
 import (
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"reflect"
 	"testing"
 )
diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index d8b195b43..45b91422a 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -22,7 +22,7 @@ type RunConfig struct {
 	SecurityGroupId          string   `mapstructure:"security_group_id"`
 	SecurityGroupIds         []string `mapstructure:"security_group_ids"`
 	SubnetId                 string   `mapstructure:"subnet_id"`
-	AssociatePublicIpAddress bool     `mapstructure:"associate_public_ip_address"`
+	AssociatePublicIpAddress string   `mapstructure:"associate_public_ip_address"`
 	TemporaryKeyPairName     string   `mapstructure:"temporary_key_pair_name"`
 	VpcId                    string   `mapstructure:"vpc_id"`
 	AvailabilityZone         string   `mapstructure:"availability_zone"`
diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go
index 5e7d8872d..9b5651c45 100644
--- a/builder/amazon/common/ssh.go
+++ b/builder/amazon/common/ssh.go
@@ -4,7 +4,7 @@ import (
 	gossh "code.google.com/p/go.crypto/ssh"
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/communicator/ssh"
 	"time"
diff --git a/builder/amazon/common/state.go b/builder/amazon/common/state.go
index eaa29e92d..16730b3eb 100644
--- a/builder/amazon/common/state.go
+++ b/builder/amazon/common/state.go
@@ -3,7 +3,7 @@ package common
 import (
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"log"
 	"time"
diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go
index 5ee486522..c4b0dfe11 100644
--- a/builder/amazon/common/step_ami_region_copy.go
+++ b/builder/amazon/common/step_ami_region_copy.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/aws"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go
index a204ca321..907fb75b9 100644
--- a/builder/amazon/common/step_create_tags.go
+++ b/builder/amazon/common/step_create_tags.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/aws"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_key_pair.go b/builder/amazon/common/step_key_pair.go
index 93ef6625d..42b7235b5 100644
--- a/builder/amazon/common/step_key_pair.go
+++ b/builder/amazon/common/step_key_pair.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"os"
diff --git a/builder/amazon/common/step_modify_ami_attributes.go b/builder/amazon/common/step_modify_ami_attributes.go
index 533d4cfd9..bd699446e 100644
--- a/builder/amazon/common/step_modify_ami_attributes.go
+++ b/builder/amazon/common/step_modify_ami_attributes.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/aws"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/aws"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index a122318c4..4faf5f547 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"io/ioutil"
@@ -18,7 +18,7 @@ type StepRunSourceInstance struct {
 	SourceAMI                string
 	IamInstanceProfile       string
 	SubnetId                 string
-	AssociatePublicIpAddress bool
+	AssociatePublicIpAddress string
 	AvailabilityZone         string
 	BlockDevices             BlockDevices
 
diff --git a/builder/amazon/common/step_security_group.go b/builder/amazon/common/step_security_group.go
index 28eb3134c..c95c877b6 100644
--- a/builder/amazon/common/step_security_group.go
+++ b/builder/amazon/common/step_security_group.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/common/uuid"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go
index e58392f84..88730c050 100644
--- a/builder/amazon/ebs/builder.go
+++ b/builder/amazon/ebs/builder.go
@@ -7,7 +7,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go
index 9dea11317..941d19c3c 100644
--- a/builder/amazon/ebs/step_create_ami.go
+++ b/builder/amazon/ebs/step_create_ami.go
@@ -2,7 +2,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/ebs/step_stop_instance.go b/builder/amazon/ebs/step_stop_instance.go
index 058c61983..2b72a1d94 100644
--- a/builder/amazon/ebs/step_stop_instance.go
+++ b/builder/amazon/ebs/step_stop_instance.go
@@ -2,7 +2,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index bb655e629..144cca46a 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -5,7 +5,7 @@ package instance
 import (
 	"errors"
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/instance/step_bundle_volume.go b/builder/amazon/instance/step_bundle_volume.go
index 4dfbd4fc4..b13c2f3f0 100644
--- a/builder/amazon/instance/step_bundle_volume.go
+++ b/builder/amazon/instance/step_bundle_volume.go
@@ -2,7 +2,7 @@ package instance
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/instance/step_register_ami.go b/builder/amazon/instance/step_register_ami.go
index 35f31882d..1d12ace3c 100644
--- a/builder/amazon/instance/step_register_ami.go
+++ b/builder/amazon/instance/step_register_ami.go
@@ -2,7 +2,7 @@ package instance
 
 import (
 	"fmt"
-	"github.com/mitchellh/goamz/ec2"
+	"github.com/CpuID/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"

From 49a131951a68606cd1f18f8f9b48c53851470608 Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 13:46:32 +1000
Subject: [PATCH 13/40] reverting testing stuff

---
 builder/amazon/chroot/builder.go                    | 2 +-
 builder/amazon/chroot/step_attach_volume.go         | 2 +-
 builder/amazon/chroot/step_create_volume.go         | 2 +-
 builder/amazon/chroot/step_instance_info.go         | 4 ++--
 builder/amazon/chroot/step_register_ami.go          | 2 +-
 builder/amazon/chroot/step_snapshot.go              | 2 +-
 builder/amazon/chroot/step_source_ami_info.go       | 2 +-
 builder/amazon/common/access_config.go              | 2 +-
 builder/amazon/common/ami_config.go                 | 2 +-
 builder/amazon/common/artifact.go                   | 4 ++--
 builder/amazon/common/block_device.go               | 2 +-
 builder/amazon/common/block_device_test.go          | 2 +-
 builder/amazon/common/ssh.go                        | 2 +-
 builder/amazon/common/state.go                      | 2 +-
 builder/amazon/common/step_ami_region_copy.go       | 4 ++--
 builder/amazon/common/step_create_tags.go           | 4 ++--
 builder/amazon/common/step_key_pair.go              | 2 +-
 builder/amazon/common/step_modify_ami_attributes.go | 4 ++--
 builder/amazon/common/step_run_source_instance.go   | 2 +-
 builder/amazon/common/step_security_group.go        | 2 +-
 builder/amazon/ebs/builder.go                       | 2 +-
 builder/amazon/ebs/step_create_ami.go               | 2 +-
 builder/amazon/ebs/step_stop_instance.go            | 2 +-
 builder/amazon/instance/builder.go                  | 2 +-
 builder/amazon/instance/step_bundle_volume.go       | 2 +-
 builder/amazon/instance/step_register_ami.go        | 2 +-
 26 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go
index 0be428f07..e898f4173 100644
--- a/builder/amazon/chroot/builder.go
+++ b/builder/amazon/chroot/builder.go
@@ -7,7 +7,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/chroot/step_attach_volume.go b/builder/amazon/chroot/step_attach_volume.go
index 6c5f06c57..ab2ddb708 100644
--- a/builder/amazon/chroot/step_attach_volume.go
+++ b/builder/amazon/chroot/step_attach_volume.go
@@ -3,7 +3,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_create_volume.go b/builder/amazon/chroot/step_create_volume.go
index e5e8e43cf..0b89cf642 100644
--- a/builder/amazon/chroot/step_create_volume.go
+++ b/builder/amazon/chroot/step_create_volume.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_instance_info.go b/builder/amazon/chroot/step_instance_info.go
index ca991e130..cb694cc07 100644
--- a/builder/amazon/chroot/step_instance_info.go
+++ b/builder/amazon/chroot/step_instance_info.go
@@ -2,8 +2,8 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/aws"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"log"
diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go
index e4d5a7b1d..cb52b646c 100644
--- a/builder/amazon/chroot/step_register_ami.go
+++ b/builder/amazon/chroot/step_register_ami.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_snapshot.go b/builder/amazon/chroot/step_snapshot.go
index c5c92d772..e065da2df 100644
--- a/builder/amazon/chroot/step_snapshot.go
+++ b/builder/amazon/chroot/step_snapshot.go
@@ -3,7 +3,7 @@ package chroot
 import (
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/chroot/step_source_ami_info.go b/builder/amazon/chroot/step_source_ami_info.go
index c2b5022df..32ca5fd9c 100644
--- a/builder/amazon/chroot/step_source_ami_info.go
+++ b/builder/amazon/chroot/step_source_ami_info.go
@@ -2,7 +2,7 @@ package chroot
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go
index 5fbf66173..1690869d0 100644
--- a/builder/amazon/common/access_config.go
+++ b/builder/amazon/common/access_config.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
+	"github.com/mitchellh/goamz/aws"
 	"github.com/mitchellh/packer/packer"
 	"strings"
 	"unicode"
diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go
index 58b1aacf0..50e831c9d 100644
--- a/builder/amazon/common/ami_config.go
+++ b/builder/amazon/common/ami_config.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
+	"github.com/mitchellh/goamz/aws"
 	"github.com/mitchellh/packer/packer"
 )
 
diff --git a/builder/amazon/common/artifact.go b/builder/amazon/common/artifact.go
index c85b7f50d..3913833d7 100644
--- a/builder/amazon/common/artifact.go
+++ b/builder/amazon/common/artifact.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/aws"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/packer/packer"
 	"log"
 	"strings"
diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go
index 81d7ee3e2..08f07e269 100644
--- a/builder/amazon/common/block_device.go
+++ b/builder/amazon/common/block_device.go
@@ -1,7 +1,7 @@
 package common
 
 import (
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 )
 
 // BlockDevice
diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go
index a66ae0f84..2e671e3d6 100644
--- a/builder/amazon/common/block_device_test.go
+++ b/builder/amazon/common/block_device_test.go
@@ -1,7 +1,7 @@
 package common
 
 import (
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"reflect"
 	"testing"
 )
diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go
index 9b5651c45..5e7d8872d 100644
--- a/builder/amazon/common/ssh.go
+++ b/builder/amazon/common/ssh.go
@@ -4,7 +4,7 @@ import (
 	gossh "code.google.com/p/go.crypto/ssh"
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/communicator/ssh"
 	"time"
diff --git a/builder/amazon/common/state.go b/builder/amazon/common/state.go
index 16730b3eb..eaa29e92d 100644
--- a/builder/amazon/common/state.go
+++ b/builder/amazon/common/state.go
@@ -3,7 +3,7 @@ package common
 import (
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"log"
 	"time"
diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go
index c4b0dfe11..5ee486522 100644
--- a/builder/amazon/common/step_ami_region_copy.go
+++ b/builder/amazon/common/step_ami_region_copy.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/aws"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go
index 907fb75b9..a204ca321 100644
--- a/builder/amazon/common/step_create_tags.go
+++ b/builder/amazon/common/step_create_tags.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/aws"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_key_pair.go b/builder/amazon/common/step_key_pair.go
index 42b7235b5..93ef6625d 100644
--- a/builder/amazon/common/step_key_pair.go
+++ b/builder/amazon/common/step_key_pair.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"os"
diff --git a/builder/amazon/common/step_modify_ami_attributes.go b/builder/amazon/common/step_modify_ami_attributes.go
index bd699446e..533d4cfd9 100644
--- a/builder/amazon/common/step_modify_ami_attributes.go
+++ b/builder/amazon/common/step_modify_ami_attributes.go
@@ -2,8 +2,8 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/aws"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/aws"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index 4faf5f547..0b5fccb3c 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 	"io/ioutil"
diff --git a/builder/amazon/common/step_security_group.go b/builder/amazon/common/step_security_group.go
index c95c877b6..28eb3134c 100644
--- a/builder/amazon/common/step_security_group.go
+++ b/builder/amazon/common/step_security_group.go
@@ -2,7 +2,7 @@ package common
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/common/uuid"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go
index 88730c050..e58392f84 100644
--- a/builder/amazon/ebs/builder.go
+++ b/builder/amazon/ebs/builder.go
@@ -7,7 +7,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go
index 941d19c3c..9dea11317 100644
--- a/builder/amazon/ebs/step_create_ami.go
+++ b/builder/amazon/ebs/step_create_ami.go
@@ -2,7 +2,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/ebs/step_stop_instance.go b/builder/amazon/ebs/step_stop_instance.go
index 2b72a1d94..058c61983 100644
--- a/builder/amazon/ebs/step_stop_instance.go
+++ b/builder/amazon/ebs/step_stop_instance.go
@@ -2,7 +2,7 @@ package ebs
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"
diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index 144cca46a..bb655e629 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -5,7 +5,7 @@ package instance
 import (
 	"errors"
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/common"
diff --git a/builder/amazon/instance/step_bundle_volume.go b/builder/amazon/instance/step_bundle_volume.go
index b13c2f3f0..4dfbd4fc4 100644
--- a/builder/amazon/instance/step_bundle_volume.go
+++ b/builder/amazon/instance/step_bundle_volume.go
@@ -2,7 +2,7 @@ package instance
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
 )
diff --git a/builder/amazon/instance/step_register_ami.go b/builder/amazon/instance/step_register_ami.go
index 1d12ace3c..35f31882d 100644
--- a/builder/amazon/instance/step_register_ami.go
+++ b/builder/amazon/instance/step_register_ami.go
@@ -2,7 +2,7 @@ package instance
 
 import (
 	"fmt"
-	"github.com/CpuID/goamz/ec2"
+	"github.com/mitchellh/goamz/ec2"
 	"github.com/mitchellh/multistep"
 	awscommon "github.com/mitchellh/packer/builder/amazon/common"
 	"github.com/mitchellh/packer/packer"

From 5cbff00afa8300cea3a5aa3b7016ed7541db4dbd Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 14:14:43 +1000
Subject: [PATCH 14/40] goamz aspects of AssociatePublicIpAddress working now

---
 builder/amazon/common/run_config.go               | 3 +--
 builder/amazon/common/step_run_source_instance.go | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index 45b91422a..423d01c82 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -22,7 +22,7 @@ type RunConfig struct {
 	SecurityGroupId          string   `mapstructure:"security_group_id"`
 	SecurityGroupIds         []string `mapstructure:"security_group_ids"`
 	SubnetId                 string   `mapstructure:"subnet_id"`
-	AssociatePublicIpAddress string   `mapstructure:"associate_public_ip_address"`
+	AssociatePublicIpAddress bool     `mapstructure:"associate_public_ip_address"`
 	TemporaryKeyPairName     string   `mapstructure:"temporary_key_pair_name"`
 	VpcId                    string   `mapstructure:"vpc_id"`
 	AvailabilityZone         string   `mapstructure:"availability_zone"`
@@ -92,7 +92,6 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
 		"ssh_username":                &c.SSHUsername,
 		"source_ami":                  &c.SourceAmi,
 		"subnet_id":                   &c.SubnetId,
-		"associate_public_ip_address": &c.AssociatePublicIpAddress,
 		"temporary_key_pair_name":     &c.TemporaryKeyPairName,
 		"vpc_id":                      &c.VpcId,
 		"availability_zone":           &c.AvailabilityZone,
diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index 0b5fccb3c..a122318c4 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -18,7 +18,7 @@ type StepRunSourceInstance struct {
 	SourceAMI                string
 	IamInstanceProfile       string
 	SubnetId                 string
-	AssociatePublicIpAddress string
+	AssociatePublicIpAddress bool
 	AvailabilityZone         string
 	BlockDevices             BlockDevices
 

From 13f55bdec6ce71216370d3ab3ba0461736eec98b Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 14:45:06 +1000
Subject: [PATCH 15/40] working AssociatePublicIpAddress support

---
 builder/amazon/common/ssh.go                      | 10 +++++++++-
 builder/amazon/common/step_run_source_instance.go |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go
index 5e7d8872d..458a7226e 100644
--- a/builder/amazon/common/ssh.go
+++ b/builder/amazon/common/ssh.go
@@ -8,6 +8,7 @@ import (
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/communicator/ssh"
 	"time"
+	"log"
 )
 
 // SSHAddress returns a function that can be given to the SSH communicator
@@ -20,7 +21,14 @@ func SSHAddress(e *ec2.EC2, port int) func(multistep.StateBag) (string, error) {
 			if i.DNSName != "" {
 				host = i.DNSName
 			} else if i.VpcId != "" {
-				host = i.PrivateIpAddress
+				log.Printf("public ip from SSHAddress: %s", i.PublicIpAddress)
+				if i.PublicIpAddress != "" {
+					log.Printf("using public ip in SSHAddress")
+					host = i.PublicIpAddress
+				} else {
+					log.Printf("using private ip in SSHAddress")
+					host = i.PrivateIpAddress
+				}
 			}
 
 			if host != "" {
diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index a122318c4..87110130b 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -110,6 +110,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
 	}
 
 	s.instance = latestInstance.(*ec2.Instance)
+	log.Printf("Public IP: %s", s.instance.PublicIpAddress)
 
 	if s.Debug {
 		if s.instance.DNSName != "" {

From 6270d759cd92881117a4cfefe10eb1bbbac57d0a Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 15:01:57 +1000
Subject: [PATCH 16/40] revert whitespace changes - not necessary anymore

---
 builder/amazon/common/run_config.go | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go
index 423d01c82..75faed662 100644
--- a/builder/amazon/common/run_config.go
+++ b/builder/amazon/common/run_config.go
@@ -86,15 +86,15 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
 	}
 
 	templates := map[string]*string{
-		"iam_instance_profile":        &c.IamInstanceProfile,
-		"instance_type":               &c.InstanceType,
-		"ssh_timeout":                 &c.RawSSHTimeout,
-		"ssh_username":                &c.SSHUsername,
-		"source_ami":                  &c.SourceAmi,
-		"subnet_id":                   &c.SubnetId,
-		"temporary_key_pair_name":     &c.TemporaryKeyPairName,
-		"vpc_id":                      &c.VpcId,
-		"availability_zone":           &c.AvailabilityZone,
+		"iam_instance_profile":    &c.IamInstanceProfile,
+		"instance_type":           &c.InstanceType,
+		"ssh_timeout":             &c.RawSSHTimeout,
+		"ssh_username":            &c.SSHUsername,
+		"source_ami":              &c.SourceAmi,
+		"subnet_id":               &c.SubnetId,
+		"temporary_key_pair_name": &c.TemporaryKeyPairName,
+		"vpc_id":                  &c.VpcId,
+		"availability_zone":       &c.AvailabilityZone,
 	}
 
 	for n, ptr := range templates {

From 4809186c12be3df12b35c452d38a89eba1ab6fa5 Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 15:02:43 +1000
Subject: [PATCH 17/40] remove excess debugging

---
 builder/amazon/common/ssh.go | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/builder/amazon/common/ssh.go b/builder/amazon/common/ssh.go
index 458a7226e..6756c62e7 100644
--- a/builder/amazon/common/ssh.go
+++ b/builder/amazon/common/ssh.go
@@ -8,7 +8,6 @@ import (
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/communicator/ssh"
 	"time"
-	"log"
 )
 
 // SSHAddress returns a function that can be given to the SSH communicator
@@ -21,12 +20,9 @@ func SSHAddress(e *ec2.EC2, port int) func(multistep.StateBag) (string, error) {
 			if i.DNSName != "" {
 				host = i.DNSName
 			} else if i.VpcId != "" {
-				log.Printf("public ip from SSHAddress: %s", i.PublicIpAddress)
 				if i.PublicIpAddress != "" {
-					log.Printf("using public ip in SSHAddress")
 					host = i.PublicIpAddress
 				} else {
-					log.Printf("using private ip in SSHAddress")
 					host = i.PrivateIpAddress
 				}
 			}

From e711255d95d8ddd2504f89a4a6702fda145b1f1e Mon Sep 17 00:00:00 2001
From: Nathan Sullivan 
Date: Tue, 26 Nov 2013 15:03:45 +1000
Subject: [PATCH 18/40] fix some debugging for PublicIpAddress

---
 builder/amazon/common/step_run_source_instance.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go
index 87110130b..77d330a21 100644
--- a/builder/amazon/common/step_run_source_instance.go
+++ b/builder/amazon/common/step_run_source_instance.go
@@ -110,13 +110,16 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
 	}
 
 	s.instance = latestInstance.(*ec2.Instance)
-	log.Printf("Public IP: %s", s.instance.PublicIpAddress)
 
 	if s.Debug {
 		if s.instance.DNSName != "" {
 			ui.Message(fmt.Sprintf("Public DNS: %s", s.instance.DNSName))
 		}
 
+		if s.instance.PublicIpAddress != "" {
+			ui.Message(fmt.Sprintf("Public IP: %s", s.instance.PublicIpAddress))
+		}
+
 		if s.instance.PrivateIpAddress != "" {
 			ui.Message(fmt.Sprintf("Private IP: %s", s.instance.PrivateIpAddress))
 		}

From 3589b0ba27898c2e17198351c60db44b311b4718 Mon Sep 17 00:00:00 2001
From: ktruong7 
Date: Tue, 26 Nov 2013 09:59:16 -0500
Subject: [PATCH 19/40] Added option to make ami public automatically

---
 builder/amazon/chroot/builder.go                    |  1 +
 builder/amazon/common/ami_config.go                 |  2 ++
 builder/amazon/common/step_modify_ami_attributes.go | 10 ++++++++++
 builder/amazon/ebs/builder.go                       |  1 +
 builder/amazon/instance/builder.go                  |  1 +
 5 files changed, 15 insertions(+)

diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go
index e898f4173..f220759d2 100644
--- a/builder/amazon/chroot/builder.go
+++ b/builder/amazon/chroot/builder.go
@@ -202,6 +202,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Description: b.config.AMIDescription,
 			Users:       b.config.AMIUsers,
 			Groups:      b.config.AMIGroups,
+			Visibility:  b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,
diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go
index 50e831c9d..e846be3a8 100644
--- a/builder/amazon/common/ami_config.go
+++ b/builder/amazon/common/ami_config.go
@@ -15,6 +15,7 @@ type AMIConfig struct {
 	AMIProductCodes []string          `mapstructure:"ami_product_codes"`
 	AMIRegions      []string          `mapstructure:"ami_regions"`
 	AMITags         map[string]string `mapstructure:"tags"`
+	AMIVisibility	string			  `mapstructure:"ami_visibility"`
 }
 
 func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
@@ -29,6 +30,7 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
 	templates := map[string]*string{
 		"ami_name":        &c.AMIName,
 		"ami_description": &c.AMIDescription,
+		"ami_visibility":  &c.AMIVisibility,
 	}
 
 	errs := make([]error, 0)
diff --git a/builder/amazon/common/step_modify_ami_attributes.go b/builder/amazon/common/step_modify_ami_attributes.go
index 533d4cfd9..1a31459d3 100644
--- a/builder/amazon/common/step_modify_ami_attributes.go
+++ b/builder/amazon/common/step_modify_ami_attributes.go
@@ -13,6 +13,7 @@ type StepModifyAMIAttributes struct {
 	Groups       []string
 	ProductCodes []string
 	Description  string
+	Visibility   string
 }
 
 func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAction {
@@ -26,6 +27,7 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
 	valid = valid || (s.Users != nil && len(s.Users) > 0)
 	valid = valid || (s.Groups != nil && len(s.Groups) > 0)
 	valid = valid || (s.ProductCodes != nil && len(s.ProductCodes) > 0)
+	valid = valid || s.Visibility == "public"
 
 	if !valid {
 		return multistep.ActionContinue
@@ -59,6 +61,14 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
 		}
 	}
 
+	if s.Visibility == "public" {
+		group := make([]string, 1)
+		group[0] = "all"
+		options["public ami"] = &ec2.ModifyImageAttribute{
+			AddGroups: group,
+		}
+	}
+
 	for region, ami := range amis {
 		ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
 		regionconn := ec2.New(ec2conn.Auth, aws.Regions[region])
diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go
index 5d68f9470..b2193a020 100644
--- a/builder/amazon/ebs/builder.go
+++ b/builder/amazon/ebs/builder.go
@@ -119,6 +119,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Description: b.config.AMIDescription,
 			Users:       b.config.AMIUsers,
 			Groups:      b.config.AMIGroups,
+			Visibility:  b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,
diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index 455a7cd01..09925fab2 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -225,6 +225,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Users:        b.config.AMIUsers,
 			Groups:       b.config.AMIGroups,
 			ProductCodes: b.config.AMIProductCodes,
+			Visibility:  b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,

From 961e58dfd03f371287a92b21316fd25c0a3a84c5 Mon Sep 17 00:00:00 2001
From: ktruong7 
Date: Wed, 27 Nov 2013 10:47:06 -0500
Subject: [PATCH 20/40] fixed format issues

---
 builder/amazon/instance/builder.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index 09925fab2..1c3bd2889 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -225,7 +225,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Users:        b.config.AMIUsers,
 			Groups:       b.config.AMIGroups,
 			ProductCodes: b.config.AMIProductCodes,
-			Visibility:  b.config.AMIVisibility,
+			Visibility:   b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,

From 29941294866baa5556082724eb2442537fd1013a Mon Sep 17 00:00:00 2001
From: ktruong7 
Date: Wed, 27 Nov 2013 10:48:32 -0500
Subject: [PATCH 21/40] fixed format issue

---
 builder/amazon/common/ami_config.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go
index e846be3a8..2602c6cf6 100644
--- a/builder/amazon/common/ami_config.go
+++ b/builder/amazon/common/ami_config.go
@@ -15,7 +15,7 @@ type AMIConfig struct {
 	AMIProductCodes []string          `mapstructure:"ami_product_codes"`
 	AMIRegions      []string          `mapstructure:"ami_regions"`
 	AMITags         map[string]string `mapstructure:"tags"`
-	AMIVisibility	string			  `mapstructure:"ami_visibility"`
+	AMIVisibility   string            `mapstructure:"ami_visibility"`
 }
 
 func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {

From 0a40b905adb93c8d91ca8ff57f15c9d81ca616f2 Mon Sep 17 00:00:00 2001
From: Kyle Conroy 
Date: Sat, 30 Nov 2013 00:01:18 -0800
Subject: [PATCH 22/40] Point gox link to correct repository

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 76d3368ce..ef498b853 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ For some additional dependencies, Go needs [Mercurial](http://mercurial.selenic.
 and [Bazaar](http://bazaar.canonical.com/en/) to be installed.
 Packer itself doesn't require these, but a dependency of a dependency does.
 
-You'll also need [`gox`](https://github.com/mitchellh/packer)
+You'll also need [`gox`](https://github.com/mitchellh/gox)
 to compile packer. You can install that with:
 
 ```

From c4ae11589dd05a8c85c4a6a041fd2ff87acba548 Mon Sep 17 00:00:00 2001
From: Phil Fenstermacher 
Date: Wed, 4 Dec 2013 14:05:07 -0500
Subject: [PATCH 23/40] Changed error message and docs to match code - qemu-img
 options are qcow2 and raw

---
 builder/qemu/builder.go                         | 2 +-
 website/source/docs/builders/qemu.html.markdown | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go
index 83169f38e..065b2436a 100644
--- a/builder/qemu/builder.go
+++ b/builder/qemu/builder.go
@@ -217,7 +217,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
 
 	if !(b.config.Format == "qcow2" || b.config.Format == "raw") {
 		errs = packer.MultiErrorAppend(
-			errs, errors.New("invalid format, only 'qcow2' or 'img' are allowed"))
+			errs, errors.New("invalid format, only 'qcow2' or 'raw' are allowed"))
 	}
 
 	if !(b.config.Accelerator == "kvm" || b.config.Accelerator == "xen") {
diff --git a/website/source/docs/builders/qemu.html.markdown b/website/source/docs/builders/qemu.html.markdown
index cfcd2601e..96f06b9cf 100644
--- a/website/source/docs/builders/qemu.html.markdown
+++ b/website/source/docs/builders/qemu.html.markdown
@@ -115,7 +115,7 @@ Optional:
   commands or kickstart type scripts must have proper adjustments for
   resulting device names. The Qemu builder uses "virtio" by default.
 
-* `format` (string) - Either "qcow2" or "img", this specifies the output
+* `format` (string) - Either "qcow2" or "raw", this specifies the output
   format of the virtual machine image. This defaults to "qcow2".
 
 * `headless` (bool) - Packer defaults to building virtual machines by

From d0387d1d3a9a270b2a602cf4b7e96b7ea3d0ca5c Mon Sep 17 00:00:00 2001
From: adrian kalaveshi 
Date: Thu, 5 Dec 2013 21:36:34 +0000
Subject: [PATCH 24/40] Trivial bug fix in mechanism to clean installation ISOs
 for VMware builder

The resolution of Bug #608 still had issues.  This change removes a
superfluous period.

Testing Done:
- built packer with my change
- built VMware VMs and saw that the vmx file had the expected
  changes.
---
 builder/vmware/step_clean_vmx.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builder/vmware/step_clean_vmx.go b/builder/vmware/step_clean_vmx.go
index c8a66c5e0..a40855d41 100644
--- a/builder/vmware/step_clean_vmx.go
+++ b/builder/vmware/step_clean_vmx.go
@@ -55,12 +55,12 @@ func (s stepCleanVMX) Run(state multistep.StateBag) multistep.StepAction {
 			continue
 		}
 
-		filenameKey := match + ".filename"
+		filenameKey := match + "filename"
 		if filename, ok := vmxData[filenameKey]; ok {
 			if filename == isoPath {
 				// Change the CD-ROM device back to auto-detect to eject
 				vmxData[filenameKey] = "auto detect"
-				vmxData[match+".devicetype"] = "cdrom-raw"
+				vmxData[match+"devicetype"] = "cdrom-raw"
 			}
 		}
 	}

From 6621b16ddb4eb63c78510af9b986442af620c1bb Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 17:59:45 -0800
Subject: [PATCH 25/40] Update CHANGELOG

---
 CHANGELOG.md | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9ac6e548..c7cd131af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,16 @@
 ## 0.4.1 (unreleased)
 
+IMPROVEMENTS:
+
+* builder/openstack: A "proxy\_url" setting was added to define an HTTP
+  proxy to use when building with this builder. [GH-637]
+
 BUG FIXES:
 
 * core: Don't change background color on CLI anymore, making things look
   a tad nicer in some terminals.
+* builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
+  get stuck with ISO. [GH-685]
 
 ## 0.4.0 (November 19, 2013)
 

From 5d420ce1c1442a331c254daba5c0dc4559e75333 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:09:05 -0800
Subject: [PATCH 26/40] Revert "Merge pull request #663 from
 ktruong7/public-AMI"

This reverts commit b2fc77870b825403ea068ba63f66ac28c76b3e88, reversing
changes made to 4789d3acc8937757ee7a430199bbc39671ba93c7.

This is already possible by setting groups.
---
 builder/amazon/chroot/builder.go                    |  1 -
 builder/amazon/common/ami_config.go                 |  2 --
 builder/amazon/common/step_modify_ami_attributes.go | 10 ----------
 builder/amazon/ebs/builder.go                       |  1 -
 builder/amazon/instance/builder.go                  |  1 -
 5 files changed, 15 deletions(-)

diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go
index f220759d2..e898f4173 100644
--- a/builder/amazon/chroot/builder.go
+++ b/builder/amazon/chroot/builder.go
@@ -202,7 +202,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Description: b.config.AMIDescription,
 			Users:       b.config.AMIUsers,
 			Groups:      b.config.AMIGroups,
-			Visibility:  b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,
diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go
index 2602c6cf6..50e831c9d 100644
--- a/builder/amazon/common/ami_config.go
+++ b/builder/amazon/common/ami_config.go
@@ -15,7 +15,6 @@ type AMIConfig struct {
 	AMIProductCodes []string          `mapstructure:"ami_product_codes"`
 	AMIRegions      []string          `mapstructure:"ami_regions"`
 	AMITags         map[string]string `mapstructure:"tags"`
-	AMIVisibility   string            `mapstructure:"ami_visibility"`
 }
 
 func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
@@ -30,7 +29,6 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
 	templates := map[string]*string{
 		"ami_name":        &c.AMIName,
 		"ami_description": &c.AMIDescription,
-		"ami_visibility":  &c.AMIVisibility,
 	}
 
 	errs := make([]error, 0)
diff --git a/builder/amazon/common/step_modify_ami_attributes.go b/builder/amazon/common/step_modify_ami_attributes.go
index 1a31459d3..533d4cfd9 100644
--- a/builder/amazon/common/step_modify_ami_attributes.go
+++ b/builder/amazon/common/step_modify_ami_attributes.go
@@ -13,7 +13,6 @@ type StepModifyAMIAttributes struct {
 	Groups       []string
 	ProductCodes []string
 	Description  string
-	Visibility   string
 }
 
 func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAction {
@@ -27,7 +26,6 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
 	valid = valid || (s.Users != nil && len(s.Users) > 0)
 	valid = valid || (s.Groups != nil && len(s.Groups) > 0)
 	valid = valid || (s.ProductCodes != nil && len(s.ProductCodes) > 0)
-	valid = valid || s.Visibility == "public"
 
 	if !valid {
 		return multistep.ActionContinue
@@ -61,14 +59,6 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
 		}
 	}
 
-	if s.Visibility == "public" {
-		group := make([]string, 1)
-		group[0] = "all"
-		options["public ami"] = &ec2.ModifyImageAttribute{
-			AddGroups: group,
-		}
-	}
-
 	for region, ami := range amis {
 		ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
 		regionconn := ec2.New(ec2conn.Auth, aws.Regions[region])
diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go
index b2193a020..5d68f9470 100644
--- a/builder/amazon/ebs/builder.go
+++ b/builder/amazon/ebs/builder.go
@@ -119,7 +119,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Description: b.config.AMIDescription,
 			Users:       b.config.AMIUsers,
 			Groups:      b.config.AMIGroups,
-			Visibility:  b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,
diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index 1c3bd2889..455a7cd01 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -225,7 +225,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
 			Users:        b.config.AMIUsers,
 			Groups:       b.config.AMIGroups,
 			ProductCodes: b.config.AMIProductCodes,
-			Visibility:   b.config.AMIVisibility,
 		},
 		&awscommon.StepCreateTags{
 			Tags: b.config.AMITags,

From aeeb64b576007262f73f1b4b388364ce76dd603c Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:17:20 -0800
Subject: [PATCH 27/40] Update CHANGELOG

---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7cd131af..22bea8053 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 IMPROVEMENTS:
 
+* builder/amazon/ebs: New option allows associating a public IP with
+  non-default VPC instances. [GH-660]
 * builder/openstack: A "proxy\_url" setting was added to define an HTTP
   proxy to use when building with this builder. [GH-637]
 

From 2dad0cdca76021765cc36e8c2974132e22ec4fb4 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:28:48 -0800
Subject: [PATCH 28/40] builder/amazon/chroot: block when obtaining lock
 [GH-689]

---
 CHANGELOG.md                           | 2 ++
 builder/amazon/chroot/lockfile_unix.go | 7 +------
 builder/amazon/chroot/step_flock.go    | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 22bea8053..6f7d06a3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ BUG FIXES:
 
 * core: Don't change background color on CLI anymore, making things look
   a tad nicer in some terminals.
+* builder/amazon/chroot: Block when obtaining file lock to allow
+  parallel builds. [GH-689]
 * builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
   get stuck with ISO. [GH-685]
 
diff --git a/builder/amazon/chroot/lockfile_unix.go b/builder/amazon/chroot/lockfile_unix.go
index f84ea0d57..1a389adb4 100644
--- a/builder/amazon/chroot/lockfile_unix.go
+++ b/builder/amazon/chroot/lockfile_unix.go
@@ -14,13 +14,8 @@ const LOCK_NB = 4
 const LOCK_UN = 8
 
 func lockFile(f *os.File) error {
-	err := syscall.Flock(int(f.Fd()), LOCK_EX|LOCK_NB)
+	err := syscall.Flock(int(f.Fd()), LOCK_EX)
 	if err != nil {
-		errno, ok := err.(syscall.Errno)
-		if ok && errno == syscall.EWOULDBLOCK {
-			return errors.New("file already locked")
-		}
-
 		return err
 	}
 
diff --git a/builder/amazon/chroot/step_flock.go b/builder/amazon/chroot/step_flock.go
index 989bd3930..9f7ca54b8 100644
--- a/builder/amazon/chroot/step_flock.go
+++ b/builder/amazon/chroot/step_flock.go
@@ -39,7 +39,7 @@ func (s *StepFlock) Run(state multistep.StateBag) multistep.StepAction {
 
 	// LOCK!
 	if err := lockFile(f); err != nil {
-		err := fmt.Errorf("Error creating lock: %s", err)
+		err := fmt.Errorf("Error obtaining lock: %s", err)
 		state.Put("error", err)
 		ui.Error(err.Error())
 		return multistep.ActionHalt

From a380391b0ed67c0893333a4d627fc2406f9a4b68 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:31:45 -0800
Subject: [PATCH 29/40] common: allow files that don't exist to be URLs
 [GH-683]

---
 CHANGELOG.md     |  1 +
 common/config.go | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6f7d06a3e..8276b4c1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ BUG FIXES:
 
 * core: Don't change background color on CLI anymore, making things look
   a tad nicer in some terminals.
+* core: multiple ISO URLs works properly in all builders. [GH-683]
 * builder/amazon/chroot: Block when obtaining file lock to allow
   parallel builds. [GH-689]
 * builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
diff --git a/common/config.go b/common/config.go
index 460eeabc7..a0204eed2 100644
--- a/common/config.go
+++ b/common/config.go
@@ -105,21 +105,21 @@ func DownloadableURL(original string) (string, error) {
 			url.Path = strings.Replace(url.Path, `\`, `/`, -1)
 		}
 
-		if _, err := os.Stat(url.Path); err != nil {
-			return "", err
-		}
+		// Only do the filepath transformations if the file appears
+		// to actually exist.
+		if _, err := os.Stat(url.Path); err == nil {
+			url.Path, err = filepath.Abs(url.Path)
+			if err != nil {
+				return "", err
+			}
 
-		url.Path, err = filepath.Abs(url.Path)
-		if err != nil {
-			return "", err
-		}
+			url.Path, err = filepath.EvalSymlinks(url.Path)
+			if err != nil {
+				return "", err
+			}
 
-		url.Path, err = filepath.EvalSymlinks(url.Path)
-		if err != nil {
-			return "", err
+			url.Path = filepath.Clean(url.Path)
 		}
-
-		url.Path = filepath.Clean(url.Path)
 	}
 
 	// Make sure it is lowercased

From 2110edb69045a43bdf97ce73f6ee3d6088e85ee1 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:32:21 -0800
Subject: [PATCH 30/40] builder/amazon/chroot: remove unused import

---
 builder/amazon/chroot/lockfile_unix.go | 1 -
 1 file changed, 1 deletion(-)

diff --git a/builder/amazon/chroot/lockfile_unix.go b/builder/amazon/chroot/lockfile_unix.go
index 1a389adb4..43e92af21 100644
--- a/builder/amazon/chroot/lockfile_unix.go
+++ b/builder/amazon/chroot/lockfile_unix.go
@@ -3,7 +3,6 @@
 package chroot
 
 import (
-	"errors"
 	"os"
 	"syscall"
 )

From 48fb1f9dfb02a79af0d6f9796f497cb43e0c5d59 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 18:36:16 -0800
Subject: [PATCH 31/40] common: fix tests

---
 common/config_test.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/config_test.go b/common/config_test.go
index ea994de51..c58c105e6 100644
--- a/common/config_test.go
+++ b/common/config_test.go
@@ -144,8 +144,8 @@ func TestDownloadableURL_FilePaths(t *testing.T) {
 	for _, prefix := range []string{"", "file://"} {
 		// Nonexistent file
 		_, err = DownloadableURL(prefix + "i/dont/exist")
-		if err == nil {
-			t.Fatal("expected err")
+		if err != nil {
+			t.Fatalf("err: %s", err)
 		}
 
 		// Good file

From f7b1c2dbc6b897ee76e11311fc4f6df21d50ae23 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:04:40 -0800
Subject: [PATCH 32/40] builder/amazon/instance: add location to upload command
 [GH-679]

---
 builder/amazon/instance/builder.go                    |  1 +
 builder/amazon/instance/step_upload_bundle.go         | 11 ++++++++++-
 .../docs/builders/amazon-instance.html.markdown       |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go
index bb655e629..db1d6c28e 100644
--- a/builder/amazon/instance/builder.go
+++ b/builder/amazon/instance/builder.go
@@ -74,6 +74,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
 			"-s {{.SecretKey}} " +
 			"-d {{.BundleDirectory}} " +
 			"--batch " +
+			"--location {{.Region}} " +
 			"--retry"
 	}
 
diff --git a/builder/amazon/instance/step_upload_bundle.go b/builder/amazon/instance/step_upload_bundle.go
index e002ff43d..ec654aa61 100644
--- a/builder/amazon/instance/step_upload_bundle.go
+++ b/builder/amazon/instance/step_upload_bundle.go
@@ -11,6 +11,7 @@ type uploadCmdData struct {
 	BucketName      string
 	BundleDirectory string
 	ManifestPath    string
+	Region          string
 	SecretKey       string
 }
 
@@ -23,12 +24,20 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction {
 	manifestPath := state.Get("manifest_path").(string)
 	ui := state.Get("ui").(packer.Ui)
 
-	var err error
+	region, err := config.Region()
+	if err != nil {
+		err := fmt.Errorf("Error retrieving region: %s", err)
+		state.Put("error", err)
+		ui.Error(err.Error())
+		return multistep.ActionHalt
+	}
+
 	config.BundleUploadCommand, err = config.tpl.Process(config.BundleUploadCommand, uploadCmdData{
 		AccessKey:       config.AccessKey,
 		BucketName:      config.S3Bucket,
 		BundleDirectory: config.BundleDestination,
 		ManifestPath:    manifestPath,
+		Region:          region.Name,
 		SecretKey:       config.SecretKey,
 	})
 	if err != nil {
diff --git a/website/source/docs/builders/amazon-instance.html.markdown b/website/source/docs/builders/amazon-instance.html.markdown
index 3135bf322..42e34e48b 100644
--- a/website/source/docs/builders/amazon-instance.html.markdown
+++ b/website/source/docs/builders/amazon-instance.html.markdown
@@ -273,6 +273,7 @@ sudo -n ec2-upload-bundle \
 	-s {{.SecretKey}} \
 	-d {{.BundleDirectory}} \
 	--batch \
+	--location {{.Region}} \
 	--retry
 ```
 

From b79506e6235085317b1ca7af19f9d3a4dcd59b63 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:05:19 -0800
Subject: [PATCH 33/40] Update CHANGELOG

---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8276b4c1c..348f8542a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ BUG FIXES:
 * core: multiple ISO URLs works properly in all builders. [GH-683]
 * builder/amazon/chroot: Block when obtaining file lock to allow
   parallel builds. [GH-689]
+* builder/amazon/instance: Add location flag to upload bundle command
+  so that building AMIs works out of us-east-1 [GH-679]
 * builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
   get stuck with ISO. [GH-685]
 

From 6211cd20283db40187049677c667e9b7e6983bc4 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:11:40 -0800
Subject: [PATCH 34/40] builder/vmware: more resilient to racing deletes
 [GH-675]

---
 CHANGELOG.md                       | 2 ++
 builder/vmware/step_clean_files.go | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 348f8542a..7d4d57961 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@ BUG FIXES:
   so that building AMIs works out of us-east-1 [GH-679]
 * builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
   get stuck with ISO. [GH-685]
+* builder/vmware: File cleanup is more resilient to file delete races
+  with the operating system. [GH-675]
 
 ## 0.4.0 (November 19, 2013)
 
diff --git a/builder/vmware/step_clean_files.go b/builder/vmware/step_clean_files.go
index cf78d45dc..d3eea4234 100644
--- a/builder/vmware/step_clean_files.go
+++ b/builder/vmware/step_clean_files.go
@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"github.com/mitchellh/multistep"
 	"github.com/mitchellh/packer/packer"
+	"os"
 	"path/filepath"
 )
 
@@ -48,8 +49,11 @@ func (stepCleanFiles) Run(state multistep.StateBag) multistep.StepAction {
 		if !keep {
 			ui.Message(fmt.Sprintf("Deleting: %s", path))
 			if err = dir.Remove(path); err != nil {
-				state.Put("error", err)
-				return multistep.ActionHalt
+				// Only report the error if the file still exists
+				if _, serr := os.Stat(path); serr == nil || os.IsNotExist(serr) {
+					state.Put("error", err)
+					return multistep.ActionHalt
+				}
 			}
 		}
 	}

From 8766a93245a9ea464803594e8d00a49c8450a8d5 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:12:49 -0800
Subject: [PATCH 35/40] builder/vmware: correct logic in cehcking if file is
 still there

---
 builder/vmware/step_clean_files.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builder/vmware/step_clean_files.go b/builder/vmware/step_clean_files.go
index d3eea4234..7b6eaa8b5 100644
--- a/builder/vmware/step_clean_files.go
+++ b/builder/vmware/step_clean_files.go
@@ -50,7 +50,7 @@ func (stepCleanFiles) Run(state multistep.StateBag) multistep.StepAction {
 			ui.Message(fmt.Sprintf("Deleting: %s", path))
 			if err = dir.Remove(path); err != nil {
 				// Only report the error if the file still exists
-				if _, serr := os.Stat(path); serr == nil || os.IsNotExist(serr) {
+				if _, serr := os.Stat(path); serr == nil || !os.IsNotExist(serr) {
 					state.Put("error", err)
 					return multistep.ActionHalt
 				}

From 2b4bdee0a25a9cf652889a9738f392215ffe30b6 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:14:20 -0800
Subject: [PATCH 36/40] website: fix docs for vmware esxi discrep [GH-674]

---
 website/source/docs/builders/vmware.html.markdown | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/website/source/docs/builders/vmware.html.markdown b/website/source/docs/builders/vmware.html.markdown
index b1086ee25..e4da7dff8 100644
--- a/website/source/docs/builders/vmware.html.markdown
+++ b/website/source/docs/builders/vmware.html.markdown
@@ -87,7 +87,8 @@ Optional:
   The default is "1", which corresponds to a growable virtual disk split in
   2GB files.  This option is for advanced usage, modify only if you
   know what you're doing.  For more information, please consult the
-  [Virtual Disk Manager User's Guide](http://www.vmware.com/pdf/VirtualDiskManager.pdf).
+  [Virtual Disk Manager User's Guide](http://www.vmware.com/pdf/VirtualDiskManager.pdf)
+  for desktop VMware clients. For ESXi, refer to the proper ESXi documentation.
 
 * `floppy_files` (array of strings) - A list of files to put onto a floppy
   disk that is attached when the VM is booted for the first time. This is

From 956f49f439de1572f82f06941bb5220d67a82b94 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Fri, 6 Dec 2013 19:30:06 -0800
Subject: [PATCH 37/40] provisioner/puppet-masterless: check for hiera config
 path [GH-656]

---
 CHANGELOG.md                                 | 2 ++
 provisioner/puppet-masterless/provisioner.go | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d4d57961..370782cf1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,8 @@ BUG FIXES:
   get stuck with ISO. [GH-685]
 * builder/vmware: File cleanup is more resilient to file delete races
   with the operating system. [GH-675]
+* provisioner/puppet-masterless: Check for hiera config path existence
+  properly. [GH-656]
 
 ## 0.4.0 (November 19, 2013)
 
diff --git a/provisioner/puppet-masterless/provisioner.go b/provisioner/puppet-masterless/provisioner.go
index 4552aef9a..05c9163cd 100644
--- a/provisioner/puppet-masterless/provisioner.go
+++ b/provisioner/puppet-masterless/provisioner.go
@@ -145,7 +145,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
 
 	// Validation
 	if p.config.HieraConfigPath != "" {
-		info, err := os.Stat(p.config.ManifestFile)
+		info, err := os.Stat(p.config.HieraConfigPath)
 		if err != nil {
 			errs = packer.MultiErrorAppend(errs,
 				fmt.Errorf("hiera_config_path is invalid: %s", err))

From 278928128518ea01a5bb92e42b05388b5f8b00a1 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Sat, 7 Dec 2013 10:31:57 -0800
Subject: [PATCH 38/40] builder/vmware: clarify guestiphack error message
 [GH-639]

---
 builder/vmware/driver_esx5.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/builder/vmware/driver_esx5.go b/builder/vmware/driver_esx5.go
index 825092abd..f23978a32 100644
--- a/builder/vmware/driver_esx5.go
+++ b/builder/vmware/driver_esx5.go
@@ -314,7 +314,8 @@ func (d *ESX5Driver) checkGuestIPHackEnabled() error {
 	}
 
 	if record["IntValue"] != "1" {
-		return errors.New("GuestIPHack is required, enable with:\n" +
+		return errors.New(
+			"GuestIPHack is required, enable by running this on the ESX machine:\n" +
 			"esxcli system settings advanced set -o /Net/GuestIPHack -i 1")
 	}
 

From c6e969e41b238916fbe3ff2189a7bd0746e52c0b Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Sat, 7 Dec 2013 21:05:53 -0800
Subject: [PATCH 39/40] v0.4.1

---
 CHANGELOG.md      | 2 +-
 packer/version.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 370782cf1..85da2de35 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 0.4.1 (unreleased)
+## 0.4.1 (December 7, 2013)
 
 IMPROVEMENTS:
 
diff --git a/packer/version.go b/packer/version.go
index 44c22cf4b..bccdead09 100644
--- a/packer/version.go
+++ b/packer/version.go
@@ -15,7 +15,7 @@ const Version = "0.4.1"
 // Any pre-release marker for the version. If this is "" (empty string),
 // then it means that it is a final release. Otherwise, this is the
 // pre-release marker.
-const VersionPrerelease = "dev"
+const VersionPrerelease = ""
 
 type versionCommand byte
 

From 73d691d31928e6014a82390467845789c48ef170 Mon Sep 17 00:00:00 2001
From: Mitchell Hashimoto 
Date: Sun, 8 Dec 2013 10:19:13 -0800
Subject: [PATCH 40/40] up version for dev

---
 CHANGELOG.md      | 4 ++++
 packer/version.go | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85da2de35..115ed3886 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.5.0 (unreleased)
+
+
+
 ## 0.4.1 (December 7, 2013)
 
 IMPROVEMENTS:
diff --git a/packer/version.go b/packer/version.go
index bccdead09..6a12da5b8 100644
--- a/packer/version.go
+++ b/packer/version.go
@@ -10,12 +10,12 @@ import (
 var GitCommit string
 
 // The version of packer.
-const Version = "0.4.1"
+const Version = "0.5.0"
 
 // Any pre-release marker for the version. If this is "" (empty string),
 // then it means that it is a final release. Otherwise, this is the
 // pre-release marker.
-const VersionPrerelease = ""
+const VersionPrerelease = "dev"
 
 type versionCommand byte