Skip to content

option to forcefully terminate an environment #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions library/elasticbeanstalk_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
required: false
default: present
choices: ['absent','present','list','details']
force_terminate:
description:
- Terminates the target environment even if another environment in the same group is dependent on it. Option is used only when state=absent
required: false
default: False

author: Harpreet Singh
extends_documentation_fragment: aws
Expand Down Expand Up @@ -98,6 +103,7 @@
app_name: Sample App
env_name: sampleApp-env
state: absent
force_terminate: True
wait_timeout: 360
region: us-west-2
'''
Expand Down Expand Up @@ -290,7 +296,8 @@ def main():
option_settings = dict(type='list',default=[]),
tags = dict(type='dict',default=dict()),
options_to_remove = dict(type='list',default=[]),
tier_name = dict(default='WebServer', choices=['WebServer','Worker'])
tier_name = dict(default='WebServer', choices=['WebServer','Worker']),
force_terminate = dict(type='bool', required=False, default=False)
),
)
module = AnsibleModule(argument_spec=argument_spec,
Expand All @@ -312,6 +319,7 @@ def main():
tags = module.params['tags']
option_settings = module.params['option_settings']
options_to_remove = module.params['options_to_remove']
force_terminate = module.params['force_terminate']

tier_type = 'Standard'
tier_name = module.params['tier_name']
Expand Down Expand Up @@ -393,7 +401,7 @@ def main():

if state == 'absent':
try:
ebs.terminate_environment(EnvironmentName=env_name)
ebs.terminate_environment(EnvironmentName=env_name, ForceTerminate=force_terminate)
env = wait_for(ebs, app_name, env_name, wait_timeout, terminated)
result = dict(changed=True, env=env)
except ClientError, e:
Expand Down