[AWS] Add helpful failure message when using wrong lb module (#40433)

Remove the default empty dict parameter for tags.
pull/40726/head
Rob 6 years ago committed by Ryan Brown
parent f16ec4e64c
commit 1b45a755a2

@ -229,6 +229,9 @@ class ApplicationLoadBalancer(ElasticLoadBalancerV2):
self.access_logs_s3_prefix = module.params.get("access_logs_s3_prefix")
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):
"""
Create a load balancer
@ -340,6 +343,9 @@ class NetworkLoadBalancer(ElasticLoadBalancerV2):
self.type = 'network'
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):
"""
Create a load balancer

@ -509,7 +509,7 @@ def main():
security_groups=dict(type='list'),
scheme=dict(default='internet-facing', choices=['internet-facing', 'internal']),
state=dict(choices=['present', 'absent'], type='str'),
tags=dict(default={}, type='dict'),
tags=dict(type='dict'),
wait_timeout=dict(type='int'),
wait=dict(default=False, type='bool')
)

Loading…
Cancel
Save