@ -59,7 +59,7 @@ options:
resource_tags:
description:
- 'A dictionary array of resource tags of the form: { tag1: value1, tag2: value2 }. Tags in this list are used in conjunction with CIDR block to uniquely identify a VPC in lieu of vpc_id. Therefore, if CIDR/Tag combination does not exits, a new VPC will be created. VPC tags not on this list will be ignored.'
required: fals e
required: tru e
default: null
aliases: []
version_added: "1.6"
@ -270,6 +270,7 @@ def create_vpc(module, vpc_conn):
subnets = module.params.get('subnets')
internet_gateway = module.params.get('internet_gateway')
route_tables = module.params.get('route_tables')
vpc_spec_tags = module.params.get('resource_tags')
wait = module.params.get('wait')
wait_timeout = int(module.params.get('wait_timeout'))
changed = False
@ -306,10 +307,9 @@ def create_vpc(module, vpc_conn):
# Done with base VPC, now change to attributes and features.
# Add resource tags
vpc_spec_tags = module.params.get('resource_tags')
vpc_tags = dict((t.name, t.value) for t in vpc_conn.get_all_tags(filters={'resource-id': vpc.id}))
if vpc_spec_tags and not set(vpc_spec_tags.items()).issubset(set(vpc_tags.items())):
if not set(vpc_spec_tags.items()).issubset(set(vpc_tags.items())):
new_tags = {}
for (key, value) in set(vpc_spec_tags.items()):
@ -408,7 +408,7 @@ def create_vpc(module, vpc_conn):
if route_tables and not isinstance(route_tables, list):
module.fail_json(msg='route tables need to be a list of dictionaries')
# Work through each route table and update/create to match dictionary array
# Work through each route table and update/create to match dictionary array
all_route_tables = []
for rt in route_tables:
try:
@ -564,7 +564,7 @@ def main():
subnets = dict(type='list'),
vpc_id = dict(),
internet_gateway = dict(type='bool', default=False),
resource_tags = dict(type='dict'),
resource_tags = dict(type='dict', required=True ),
route_tables = dict(type='list'),
state = dict(choices=['present', 'absent'], default='present'),
)