@ -46,7 +46,7 @@ options:
choices: [ "yes", "no" ]
choices: [ "yes", "no" ]
subnets:
subnets:
description:
description:
- "A dictionary array of subnets to add of the form: { cidr: ..., az: ... , tags: ... }. Where az is the desired availability zone of the subnet, but it is not required. Tags (i.e.: tags) is also optional and use dictionary form: { "Environment":"Dev", "Tier":"Web", ...}. All VPC subnets not in this list will be removed."
- "A dictionary array of subnets to add of the form: { cidr: ..., az: ... , instance_ tags: ... }. Where az is the desired availability zone of the subnet, but it is not required. Tags (i.e.: instance_ tags) is also optional and use dictionary form: { "Environment":"Dev", "Tier":"Web", ...}. All VPC subnets not in this list will be removed."
required: false
required: false
default: null
default: null
aliases: []
aliases: []
@ -137,13 +137,13 @@ EXAMPLES = '''
subnets:
subnets:
- cidr: 172.22.1.0/24
- cidr: 172.22.1.0/24
az: us-west-2c
az: us-west-2c
tags: { "Environment":"Dev", "Tier" : "Web" }
instance_ tags: { "Environment":"Dev", "Tier" : "Web" }
- cidr: 172.22.2.0/24
- cidr: 172.22.2.0/24
az: us-west-2b
az: us-west-2b
tags: { "Environment":"Dev", "Tier" : "App" }
instance_ tags: { "Environment":"Dev", "Tier" : "App" }
- cidr: 172.22.3.0/24
- cidr: 172.22.3.0/24
az: us-west-2a
az: us-west-2a
tags: { "Environment":"Dev", "Tier" : "DB" }
instance_ tags: { "Environment":"Dev", "Tier" : "DB" }
internet_gateway: True
internet_gateway: True
route_tables:
route_tables:
- subnets:
- subnets:
@ -281,7 +281,7 @@ def create_vpc(module, vpc_conn):
if add_subnet:
if add_subnet:
try:
try:
new_subnet = vpc_conn.create_subnet(vpc.id, subnet['cidr'], subnet.get('az', None))
new_subnet = vpc_conn.create_subnet(vpc.id, subnet['cidr'], subnet.get('az', None))
new_subnet_tags = subnet.get('tags', None)
new_subnet_tags = subnet.get('instance_ tags', None)
if new_subnet_tags:
if new_subnet_tags:
# Sometimes AWS takes its time to create a subnet and so using new subnets's id
# Sometimes AWS takes its time to create a subnet and so using new subnets's id
# to create tags results in exception.
# to create tags results in exception.
@ -422,7 +422,7 @@ def create_vpc(module, vpc_conn):
for sn in current_subnets:
for sn in current_subnets:
returned_subnets.append({
returned_subnets.append({
'tags': dict((t.name, t.value) for t in vpc_conn.get_all_tags(filters={'resource-id': sn.id})),
'instance_ tags': dict((t.name, t.value) for t in vpc_conn.get_all_tags(filters={'resource-id': sn.id})),
'cidr': sn.cidr_block,
'cidr': sn.cidr_block,
'az': sn.availability_zone,
'az': sn.availability_zone,
'id': sn.id,
'id': sn.id,