mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add support for stack policies in cloudformation
This commit is contained in:
parent
67def35795
commit
1a8b9b8935
1 changed files with 14 additions and 0 deletions
|
@ -60,6 +60,13 @@ options:
|
||||||
required: true
|
required: true
|
||||||
default: null
|
default: null
|
||||||
aliases: []
|
aliases: []
|
||||||
|
stack_policy:
|
||||||
|
description:
|
||||||
|
- the path of the cloudformation stack policy
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
aliases: []
|
||||||
|
version_added: "x.x"
|
||||||
tags:
|
tags:
|
||||||
description:
|
description:
|
||||||
- Dictionary of tags to associate with stack and it's resources during stack creation. Cannot be updated later.
|
- Dictionary of tags to associate with stack and it's resources during stack creation. Cannot be updated later.
|
||||||
|
@ -196,6 +203,7 @@ def main():
|
||||||
template_parameters=dict(required=False, type='dict', default={}),
|
template_parameters=dict(required=False, type='dict', default={}),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
template=dict(default=None, required=True),
|
template=dict(default=None, required=True),
|
||||||
|
stack_policy=dict(default=None, required=False),
|
||||||
disable_rollback=dict(default=False, type='bool'),
|
disable_rollback=dict(default=False, type='bool'),
|
||||||
tags=dict(default=None)
|
tags=dict(default=None)
|
||||||
)
|
)
|
||||||
|
@ -208,6 +216,10 @@ def main():
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
stack_name = module.params['stack_name']
|
stack_name = module.params['stack_name']
|
||||||
template_body = open(module.params['template'], 'r').read()
|
template_body = open(module.params['template'], 'r').read()
|
||||||
|
if module.params['stack_policy'] is not None:
|
||||||
|
stack_policy_body = open(module.params['stack_policy'], 'r').read()
|
||||||
|
else:
|
||||||
|
stack_policy_body = None
|
||||||
disable_rollback = module.params['disable_rollback']
|
disable_rollback = module.params['disable_rollback']
|
||||||
template_parameters = module.params['template_parameters']
|
template_parameters = module.params['template_parameters']
|
||||||
tags = module.params['tags']
|
tags = module.params['tags']
|
||||||
|
@ -244,6 +256,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
cfn.create_stack(stack_name, parameters=template_parameters_tup,
|
cfn.create_stack(stack_name, parameters=template_parameters_tup,
|
||||||
template_body=template_body,
|
template_body=template_body,
|
||||||
|
stack_policy_body=stack_policy_body,
|
||||||
disable_rollback=disable_rollback,
|
disable_rollback=disable_rollback,
|
||||||
capabilities=['CAPABILITY_IAM'],
|
capabilities=['CAPABILITY_IAM'],
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
@ -264,6 +277,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
cfn.update_stack(stack_name, parameters=template_parameters_tup,
|
cfn.update_stack(stack_name, parameters=template_parameters_tup,
|
||||||
template_body=template_body,
|
template_body=template_body,
|
||||||
|
stack_policy_body=stack_policy_body,
|
||||||
disable_rollback=disable_rollback,
|
disable_rollback=disable_rollback,
|
||||||
capabilities=['CAPABILITY_IAM'])
|
capabilities=['CAPABILITY_IAM'])
|
||||||
operation = 'UPDATE'
|
operation = 'UPDATE'
|
||||||
|
|
Loading…
Reference in a new issue