Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed vpc provisioning / clarified group_id usage #3629

Merged
merged 1 commit into from
Jul 28, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions library/cloud/ec2
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ options:
group_id:
version_added: "1.1"
description:
- security group id to use with the instance
- security group id (or list of ids) to use with the instance
required: false
default: null
aliases: []
Expand Down Expand Up @@ -232,7 +232,7 @@ local_action:
instance_type: m1.small
image: ami-6e649707
wait: yes
vpc_subnet_id: subnet-29e63245'
vpc_subnet_id: subnet-29e63245


# Launch instances, runs some tasks
Expand Down Expand Up @@ -354,7 +354,7 @@ def create_instances(module, ec2):
instance_profile_name = module.params.get('instance_profile_name')


# Here we try to lookup the group name from the security group id - if group_id is set.
# group_id and group_name are exclusive of each other
if group_id and group_name:
module.fail_json(msg = str("Use only one type of parameter (group_name) or (group_id)"))
sys.exit(1)
Expand All @@ -372,6 +372,9 @@ def create_instances(module, ec2):
group_name = [group_name]
# Now we try to lookup the group id testing if group exists.
elif group_id:
#wrap the group_id in a list if it's not one already
if type(group_id) == str:
group_id = [group_id]
grp_details = ec2.get_all_security_groups(group_ids=group_id)
grp_item = grp_details[0]
group_name = [grp_item.name]
Expand Down