From d3f5238c096f58945f02b7270657e8c8cf235dd3 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Fri, 24 Aug 2018 13:04:15 -0400 Subject: [PATCH] Fix dangerous elb_application_lb state (#44646) * elb_application_lb: fix dangerous default of deleting an ELB if state is omitted by changing state to default to present to be more like other AWS modules --- changelogs/fragments/elb_application_lb_fix_state_default.yml | 4 ++++ lib/ansible/modules/cloud/amazon/elb_application_lb.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/elb_application_lb_fix_state_default.yml diff --git a/changelogs/fragments/elb_application_lb_fix_state_default.yml b/changelogs/fragments/elb_application_lb_fix_state_default.yml new file mode 100644 index 00000000000..d789ab86c7f --- /dev/null +++ b/changelogs/fragments/elb_application_lb_fix_state_default.yml @@ -0,0 +1,4 @@ +--- +bugfixes: +- elb_application_lb - Fix a dangerous behavior of deleting an ELB if state was omitted from the task. + Now state defaults to 'present', which is typical throughout AWS modules. diff --git a/lib/ansible/modules/cloud/amazon/elb_application_lb.py b/lib/ansible/modules/cloud/amazon/elb_application_lb.py index 5587d1ca6a5..9060daa4963 100644 --- a/lib/ansible/modules/cloud/amazon/elb_application_lb.py +++ b/lib/ansible/modules/cloud/amazon/elb_application_lb.py @@ -102,7 +102,7 @@ options: state: description: - Create or destroy the load balancer. - required: true + default: present choices: [ 'present', 'absent' ] tags: description: @@ -528,7 +528,7 @@ def main(): subnets=dict(type='list'), security_groups=dict(type='list'), scheme=dict(default='internet-facing', choices=['internet-facing', 'internal']), - state=dict(choices=['present', 'absent'], type='str'), + state=dict(choices=['present', 'absent'], default='present'), tags=dict(type='dict'), wait_timeout=dict(type='int'), wait=dict(default=False, type='bool'),