mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge branch 'psa-resource-tag-required' into devel
This commit is contained in:
commit
2184b15542
1 changed files with 33 additions and 33 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
|
||||||
|
@ -318,10 +319,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()):
|
||||||
|
@ -578,7 +578,7 @@ def main():
|
||||||
subnets = dict(type='list', default=[]),
|
subnets = dict(type='list', default=[]),
|
||||||
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', default=[]),
|
route_tables = dict(type='list', default=[]),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue