Skip to content

Commit

Permalink
adding ability to specify placement group
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonbd1 authored and R. Tyler Croy committed Jul 3, 2016
1 parent 924d945 commit 46097fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/vagrant-aws/action/run_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions lib/vagrant-aws/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 46097fb

Please sign in to comment.