diff --git a/lib/vagrant-aws/action/run_instance.rb b/lib/vagrant-aws/action/run_instance.rb index b37e4c64..81afe55d 100644 --- a/lib/vagrant-aws/action/run_instance.rb +++ b/lib/vagrant-aws/action/run_instance.rb @@ -28,6 +28,7 @@ def call(env) region_config = env[:machine].provider_config.get_region_config(region) ami = region_config.ami availability_zone = region_config.availability_zone + placement_group = region_config.placement_group instance_type = region_config.instance_type keypair = region_config.keypair_name private_ip_address = region_config.private_ip_address @@ -63,6 +64,7 @@ def call(env) env[:ui].info(" -- AMI: #{ami}") env[:ui].info(" -- Region: #{region}") env[:ui].info(" -- Availability Zone: #{availability_zone}") if availability_zone + env[:ui].info(" -- Placement Group: #{placement_group}") if placement_group env[:ui].info(" -- Keypair: #{keypair}") if keypair env[:ui].info(" -- Subnet ID: #{subnet_id}") if subnet_id env[:ui].info(" -- IAM Instance Profile ARN: #{iam_instance_profile_arn}") if iam_instance_profile_arn @@ -82,6 +84,7 @@ def call(env) options = { :availability_zone => availability_zone, + :placement_group => placement_group, :flavor_id => instance_type, :image_id => ami, :key_name => keypair, diff --git a/lib/vagrant-aws/config.rb b/lib/vagrant-aws/config.rb index 30a19cb4..ffea15d8 100644 --- a/lib/vagrant-aws/config.rb +++ b/lib/vagrant-aws/config.rb @@ -20,6 +20,12 @@ class Config < Vagrant.plugin("2", :config) # @return [String] attr_accessor :availability_zone + # The placement group to launch the instance into. If nil, it will + # not use a placement group + # + # @return [String] + attr_accessor :placement_group + # The timeout to wait for an instance to become ready. # # @return [Fixnum] @@ -201,6 +207,7 @@ def initialize(region_specific=false) @ami = UNSET_VALUE @availability_zone = UNSET_VALUE @instance_check_interval = UNSET_VALUE + @placement_group = UNSET_VALUE @instance_ready_timeout = UNSET_VALUE @instance_package_timeout = UNSET_VALUE @instance_type = UNSET_VALUE @@ -361,6 +368,7 @@ def finalize! # generally defaults to this as well. @region = "us-east-1" if @region == UNSET_VALUE @availability_zone = nil if @availability_zone == UNSET_VALUE + @placement_group = nil if @placement_group == UNSET_VALUE @endpoint = nil if @endpoint == UNSET_VALUE @version = nil if @version == UNSET_VALUE