[AWS] Add helpful failure message when using wrong lb module (#40433)
Remove the default empty dict parameter for tags.
This commit is contained in:
parent
f16ec4e64c
commit
1b45a755a2
2 changed files with 7 additions and 1 deletions
|
@ -229,6 +229,9 @@ class ApplicationLoadBalancer(ElasticLoadBalancerV2):
|
||||||
self.access_logs_s3_prefix = module.params.get("access_logs_s3_prefix")
|
self.access_logs_s3_prefix = module.params.get("access_logs_s3_prefix")
|
||||||
self.idle_timeout = module.params.get("idle_timeout")
|
self.idle_timeout = module.params.get("idle_timeout")
|
||||||
|
|
||||||
|
if self.elb is not None and self.elb['Type'] != 'application':
|
||||||
|
self.module.fail_json(msg="The load balancer type you are trying to manage is not application. Try elb_network_lb module instead.")
|
||||||
|
|
||||||
def create_elb(self):
|
def create_elb(self):
|
||||||
"""
|
"""
|
||||||
Create a load balancer
|
Create a load balancer
|
||||||
|
@ -340,6 +343,9 @@ class NetworkLoadBalancer(ElasticLoadBalancerV2):
|
||||||
self.type = 'network'
|
self.type = 'network'
|
||||||
self.cross_zone_load_balancing = module.params.get('cross_zone_load_balancing')
|
self.cross_zone_load_balancing = module.params.get('cross_zone_load_balancing')
|
||||||
|
|
||||||
|
if self.elb is not None and self.elb['Type'] != 'network':
|
||||||
|
self.module.fail_json(msg="The load balancer type you are trying to manage is not network. Try elb_application_lb module instead.")
|
||||||
|
|
||||||
def create_elb(self):
|
def create_elb(self):
|
||||||
"""
|
"""
|
||||||
Create a load balancer
|
Create a load balancer
|
||||||
|
|
|
@ -509,7 +509,7 @@ def main():
|
||||||
security_groups=dict(type='list'),
|
security_groups=dict(type='list'),
|
||||||
scheme=dict(default='internet-facing', choices=['internet-facing', 'internal']),
|
scheme=dict(default='internet-facing', choices=['internet-facing', 'internal']),
|
||||||
state=dict(choices=['present', 'absent'], type='str'),
|
state=dict(choices=['present', 'absent'], type='str'),
|
||||||
tags=dict(default={}, type='dict'),
|
tags=dict(type='dict'),
|
||||||
wait_timeout=dict(type='int'),
|
wait_timeout=dict(type='int'),
|
||||||
wait=dict(default=False, type='bool')
|
wait=dict(default=False, type='bool')
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue