* allow elb scheme to be updated by restarting the resource use ensure_gone and require wait option * fix pep8 * fix yaml * requested changes * fix fail_json
This commit is contained in:
parent
e1d896052d
commit
2618e6d516
1 changed files with 22 additions and 5 deletions
|
@ -108,6 +108,9 @@ options:
|
|||
scheme:
|
||||
description:
|
||||
- The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'.
|
||||
If you choose to update your scheme with a different value the ELB will be destroyed and
|
||||
recreated. To update scheme you must use the option wait.
|
||||
choices: ["internal", "internet-facing"]
|
||||
required: false
|
||||
default: 'internet-facing'
|
||||
version_added: "1.7"
|
||||
|
@ -494,10 +497,15 @@ class ElbManager(object):
|
|||
# Zones and listeners will be added at creation
|
||||
self._create_elb()
|
||||
else:
|
||||
self._set_zones()
|
||||
self._set_security_groups()
|
||||
self._set_elb_listeners()
|
||||
self._set_subnets()
|
||||
if self._get_scheme():
|
||||
# the only way to change the scheme is by recreating the resource
|
||||
self.ensure_gone()
|
||||
self._create_elb()
|
||||
else:
|
||||
self._set_zones()
|
||||
self._set_security_groups()
|
||||
self._set_elb_listeners()
|
||||
self._set_subnets()
|
||||
self._set_health_check()
|
||||
# boto has introduced support for some ELB attributes in
|
||||
# different versions, so we check first before trying to
|
||||
|
@ -873,6 +881,15 @@ class ElbManager(object):
|
|||
if subnets_to_detach:
|
||||
self._detach_subnets(subnets_to_detach)
|
||||
|
||||
def _get_scheme(self):
|
||||
"""Determine if the current scheme is different than the scheme of the ELB"""
|
||||
if self.scheme:
|
||||
if self.elb.scheme != self.scheme:
|
||||
if not self.wait:
|
||||
self.module.fail_json(msg="Unable to modify scheme without using the wait option")
|
||||
return True
|
||||
return False
|
||||
|
||||
def _set_zones(self):
|
||||
"""Determine which zones need to be enabled or disabled on the ELB"""
|
||||
if self.zones:
|
||||
|
@ -1246,7 +1263,7 @@ def main():
|
|||
health_check={'default': None, 'required': False, 'type': 'dict'},
|
||||
subnets={'default': None, 'required': False, 'type': 'list'},
|
||||
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
|
||||
scheme={'default': 'internet-facing', 'required': False},
|
||||
scheme={'default': 'internet-facing', 'required': False, 'choices': ['internal', 'internet-facing']},
|
||||
connection_draining_timeout={'default': None, 'required': False, 'type': 'int'},
|
||||
idle_timeout={'default': None, 'type': 'int', 'required': False},
|
||||
cross_az_load_balancing={'default': None, 'type': 'bool', 'required': False},
|
||||
|
|
Loading…
Reference in a new issue