Skip to content

Commit

Permalink
ec2_group: Request a fresh group object after creation
Browse files Browse the repository at this point in the history
When a group is created, an egress_rule ALLOW ALL to 0.0.0.0/0 is added
automatically but it's not reflected in the object returned by the AWS API
call. After creation we re-read the group for getting an updated object.
  • Loading branch information
mmoya committed Mar 20, 2014
1 parent 649fcd3 commit 3156df9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/cloud/ec2_group
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ def main():
'''no match found, create it'''
if not module.check_mode:
group = ec2.create_security_group(name, description, vpc_id=vpc_id)

# When a group is created, an egress_rule ALLOW ALL
# to 0.0.0.0/0 is added automatically but it's not
# reflected in the object returned by the AWS API
# call. We re-read the group for getting an updated object
group = ec2.get_all_security_groups(group_ids=(group.id,))[0]
changed = True
else:
module.fail_json(msg="Unsupported state requested: %s" % state)
Expand Down

0 comments on commit 3156df9

Please sign in to comment.