Make resource_tags required and do whitespace cleanup
This commit is contained in:
parent
8e6a60dfd6
commit
714a9fda64
1 changed files with 34 additions and 34 deletions
|
@ -59,7 +59,7 @@ options:
|
||||||
resource_tags:
|
resource_tags:
|
||||||
description:
|
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.'
|
- '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: false
|
required: true
|
||||||
default: null
|
default: null
|
||||||
aliases: []
|
aliases: []
|
||||||
version_added: "1.6"
|
version_added: "1.6"
|
||||||
|
@ -270,6 +270,7 @@ def create_vpc(module, vpc_conn):
|
||||||
subnets = module.params.get('subnets')
|
subnets = module.params.get('subnets')
|
||||||
internet_gateway = module.params.get('internet_gateway')
|
internet_gateway = module.params.get('internet_gateway')
|
||||||
route_tables = module.params.get('route_tables')
|
route_tables = module.params.get('route_tables')
|
||||||
|
vpc_spec_tags = module.params.get('resource_tags')
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = int(module.params.get('wait_timeout'))
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -306,10 +307,9 @@ def create_vpc(module, vpc_conn):
|
||||||
# Done with base VPC, now change to attributes and features.
|
# Done with base VPC, now change to attributes and features.
|
||||||
|
|
||||||
# Add resource tags
|
# 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}))
|
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 = {}
|
new_tags = {}
|
||||||
|
|
||||||
for (key, value) in set(vpc_spec_tags.items()):
|
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):
|
if route_tables and not isinstance(route_tables, list):
|
||||||
module.fail_json(msg='route tables need to be a list of dictionaries')
|
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 = []
|
all_route_tables = []
|
||||||
for rt in route_tables:
|
for rt in route_tables:
|
||||||
try:
|
try:
|
||||||
|
@ -564,7 +564,7 @@ def main():
|
||||||
subnets = dict(type='list'),
|
subnets = dict(type='list'),
|
||||||
vpc_id = dict(),
|
vpc_id = dict(),
|
||||||
internet_gateway = dict(type='bool', default=False),
|
internet_gateway = dict(type='bool', default=False),
|
||||||
resource_tags = dict(type='dict'),
|
resource_tags = dict(type='dict', required=True),
|
||||||
route_tables = dict(type='list'),
|
route_tables = dict(type='list'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue