* 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:
|
scheme:
|
||||||
description:
|
description:
|
||||||
- The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'.
|
- 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
|
required: false
|
||||||
default: 'internet-facing'
|
default: 'internet-facing'
|
||||||
version_added: "1.7"
|
version_added: "1.7"
|
||||||
|
@ -493,6 +496,11 @@ class ElbManager(object):
|
||||||
if not self.elb:
|
if not self.elb:
|
||||||
# Zones and listeners will be added at creation
|
# Zones and listeners will be added at creation
|
||||||
self._create_elb()
|
self._create_elb()
|
||||||
|
else:
|
||||||
|
if self._get_scheme():
|
||||||
|
# the only way to change the scheme is by recreating the resource
|
||||||
|
self.ensure_gone()
|
||||||
|
self._create_elb()
|
||||||
else:
|
else:
|
||||||
self._set_zones()
|
self._set_zones()
|
||||||
self._set_security_groups()
|
self._set_security_groups()
|
||||||
|
@ -873,6 +881,15 @@ class ElbManager(object):
|
||||||
if subnets_to_detach:
|
if subnets_to_detach:
|
||||||
self._detach_subnets(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):
|
def _set_zones(self):
|
||||||
"""Determine which zones need to be enabled or disabled on the ELB"""
|
"""Determine which zones need to be enabled or disabled on the ELB"""
|
||||||
if self.zones:
|
if self.zones:
|
||||||
|
@ -1246,7 +1263,7 @@ def main():
|
||||||
health_check={'default': None, 'required': False, 'type': 'dict'},
|
health_check={'default': None, 'required': False, 'type': 'dict'},
|
||||||
subnets={'default': None, 'required': False, 'type': 'list'},
|
subnets={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
|
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'},
|
connection_draining_timeout={'default': None, 'required': False, 'type': 'int'},
|
||||||
idle_timeout={'default': None, 'type': 'int', 'required': False},
|
idle_timeout={'default': None, 'type': 'int', 'required': False},
|
||||||
cross_az_load_balancing={'default': None, 'type': 'bool', 'required': False},
|
cross_az_load_balancing={'default': None, 'type': 'bool', 'required': False},
|
||||||
|
|
Loading…
Reference in a new issue