Make resource_tags required and do whitespace cleanup
This commit is contained in:
parent
14cf3c4d2a
commit
d5b6781482
1 changed files with 34 additions and 34 deletions
|
@ -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: false
|
||||
required: true
|
||||
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()):
|
||||
|
@ -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'),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue