diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index b6e13dcc0..9467d42bd 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -77,10 +77,6 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { c.RunTags = make(map[string]string) } - if c.SpotTags == nil { - c.SpotTags = make(map[string]string) - } - // Validation errs := c.Comm.Prepare(ctx) @@ -123,6 +119,13 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error { } } + if c.SpotTags != nil { + if c.SpotPrice == "" || c.SpotPrice == "0" { + errs = append(errs, fmt.Errorf( + "spot_tags should not be set when not requesting a spot instance")) + } + } + if c.UserData != "" && c.UserDataFile != "" { errs = append(errs, fmt.Errorf("Only one of user_data or user_data_file can be specified.")) } else if c.UserDataFile != "" { diff --git a/website/source/docs/builders/amazon-ebs.html.md b/website/source/docs/builders/amazon-ebs.html.md index 2db8c6d9f..c09591768 100644 --- a/website/source/docs/builders/amazon-ebs.html.md +++ b/website/source/docs/builders/amazon-ebs.html.md @@ -344,7 +344,7 @@ builder. `Linux/UNIX (Amazon VPC)`, `SUSE Linux (Amazon VPC)`, `Windows (Amazon VPC)` - `spot_tags` (object of key/value strings) - Requires `spot_price` to - be set. This tells Packer to aplly tags to the spot request that is + be set. This tells Packer to apply tags to the spot request that is issued. - `sriov_support` (boolean) - Enable enhanced networking (SriovNetSupport but not ENA) diff --git a/website/source/docs/builders/amazon-ebssurrogate.html.md b/website/source/docs/builders/amazon-ebssurrogate.html.md index f29eb6507..881cce45e 100644 --- a/website/source/docs/builders/amazon-ebssurrogate.html.md +++ b/website/source/docs/builders/amazon-ebssurrogate.html.md @@ -337,7 +337,7 @@ builder. `Linux/UNIX (Amazon VPC)`, `SUSE Linux (Amazon VPC)`, `Windows (Amazon VPC)` - `spot_tags` (object of key/value strings) - Requires `spot_price` to - be set. This tells Packer to aplly tags to the spot request that is + be set. This tells Packer to apply tags to the spot request that is issued. - `sriov_support` (boolean) - Enable enhanced networking (SriovNetSupport but not ENA) diff --git a/website/source/docs/builders/amazon-ebsvolume.html.md b/website/source/docs/builders/amazon-ebsvolume.html.md index 880d8b49f..a3ff74785 100644 --- a/website/source/docs/builders/amazon-ebsvolume.html.md +++ b/website/source/docs/builders/amazon-ebsvolume.html.md @@ -265,7 +265,7 @@ builder. `Linux/UNIX (Amazon VPC)`, `SUSE Linux (Amazon VPC)` or `Windows (Amazon VPC)` - `spot_tags` (object of key/value strings) - Requires `spot_price` to - be set. This tells Packer to aplly tags to the spot request that is + be set. This tells Packer to apply tags to the spot request that is issued. - `sriov_support` (boolean) - Enable enhanced networking (SriovNetSupport but not ENA) diff --git a/website/source/docs/builders/amazon-instance.html.md b/website/source/docs/builders/amazon-instance.html.md index c3f3d76b8..00700dfb5 100644 --- a/website/source/docs/builders/amazon-instance.html.md +++ b/website/source/docs/builders/amazon-instance.html.md @@ -340,7 +340,7 @@ builder. `Linux/UNIX (Amazon VPC)`, `SUSE Linux (Amazon VPC)`, `Windows (Amazon VPC)` - `spot_tags` (object of key/value strings) - Requires `spot_price` to - be set. This tells Packer to aplly tags to the spot request that is + be set. This tells Packer to apply tags to the spot request that is issued. - `sriov_support` (boolean) - Enable enhanced networking (SriovNetSupport but not ENA)