Merge branch 'resource-tag-required' of https://github.com/psa/ansible into psa-resource-tag-required
This commit is contained in:
commit
56b87e8bba
1 changed files with 33 additions and 33 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
|
||||
|
@ -311,10 +312,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()):
|
||||
|
@ -571,7 +571,7 @@ def main():
|
|||
subnets = dict(type='list', default=[]),
|
||||
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', default=[]),
|
||||
state = dict(choices=['present', 'absent'], default='present'),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue