mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudformation: add create_timeout attribute (#36445)
* cloudformation: add create_timeout attribute * No default value * Only applies on stack creation * In minutes
This commit is contained in:
parent
f8d20f970f
commit
6281441e4d
1 changed files with 20 additions and 2 deletions
|
@ -30,6 +30,12 @@ options:
|
||||||
- If a stacks fails to form, rollback will remove the stack
|
- If a stacks fails to form, rollback will remove the stack
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
|
create_timeout:
|
||||||
|
description:
|
||||||
|
- The amount of time (in minutes) that can pass before the stack status becomes CREATE_FAILED
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
version_added: "2.6"
|
||||||
template_parameters:
|
template_parameters:
|
||||||
description:
|
description:
|
||||||
- A list of hashes of all the template variables for the stack. The value can be a string or a dict.
|
- A list of hashes of all the template variables for the stack. The value can be a string or a dict.
|
||||||
|
@ -207,6 +213,15 @@ EXAMPLES = '''
|
||||||
template_url: https://s3.amazonaws.com/my-bucket/cloudformation.template
|
template_url: https://s3.amazonaws.com/my-bucket/cloudformation.template
|
||||||
termination_protection: yes
|
termination_protection: yes
|
||||||
|
|
||||||
|
# Configure TimeoutInMinutes before the stack status becomes CREATE_FAILED
|
||||||
|
# In this case, if disable_rollback is not set or is set to false, the stack will be rolled back.
|
||||||
|
- name: enable termination protection during stack creation
|
||||||
|
cloudformation:
|
||||||
|
stack_name: my_stack
|
||||||
|
state: present
|
||||||
|
template_url: https://s3.amazonaws.com/my-bucket/cloudformation.template
|
||||||
|
create_timeout: 5
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
@ -301,9 +316,11 @@ def create_stack(module, stack_params, cfn):
|
||||||
if 'TemplateBody' not in stack_params and 'TemplateURL' not in stack_params:
|
if 'TemplateBody' not in stack_params and 'TemplateURL' not in stack_params:
|
||||||
module.fail_json(msg="Either 'template', 'template_body' or 'template_url' is required when the stack does not exist.")
|
module.fail_json(msg="Either 'template', 'template_body' or 'template_url' is required when the stack does not exist.")
|
||||||
|
|
||||||
# 'disablerollback' and 'EnableTerminationProtection' only
|
# 'DisableRollback', 'TimeoutInMinutes' and 'EnableTerminationProtection'
|
||||||
# apply on creation, not update.
|
# only apply on creation, not update.
|
||||||
stack_params['DisableRollback'] = module.params['disable_rollback']
|
stack_params['DisableRollback'] = module.params['disable_rollback']
|
||||||
|
if module.params.get('create_timeout') is not None:
|
||||||
|
stack_params['TimeoutInMinutes'] = module.params['create_timeout']
|
||||||
if module.params.get('termination_protection') is not None:
|
if module.params.get('termination_protection') is not None:
|
||||||
if boto_supports_termination_protection(cfn):
|
if boto_supports_termination_protection(cfn):
|
||||||
stack_params['EnableTerminationProtection'] = bool(module.params.get('termination_protection'))
|
stack_params['EnableTerminationProtection'] = bool(module.params.get('termination_protection'))
|
||||||
|
@ -542,6 +559,7 @@ def main():
|
||||||
notification_arns=dict(default=None, required=False),
|
notification_arns=dict(default=None, required=False),
|
||||||
stack_policy=dict(default=None, required=False),
|
stack_policy=dict(default=None, required=False),
|
||||||
disable_rollback=dict(default=False, type='bool'),
|
disable_rollback=dict(default=False, type='bool'),
|
||||||
|
create_timeout=dict(default=None, type='int'),
|
||||||
template_url=dict(default=None, required=False),
|
template_url=dict(default=None, required=False),
|
||||||
template_body=dict(default=None, require=False),
|
template_body=dict(default=None, require=False),
|
||||||
template_format=dict(default=None, choices=['json', 'yaml'], required=False),
|
template_format=dict(default=None, choices=['json', 'yaml'], required=False),
|
||||||
|
|
Loading…
Add table
Reference in a new issue