Merge pull request #2262 from abruehl/cf_limit_implicit_nlb_names_to_32_char

ELBv2 LBs names must be 32 char or shorter
This commit is contained in:
Steve Pulec 2019-07-01 21:01:57 -05:00 committed by GitHub
commit 29c3bc30d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,7 +246,8 @@ def resource_name_property_from_type(resource_type):
def generate_resource_name(resource_type, stack_name, logical_id):
if resource_type == "AWS::ElasticLoadBalancingV2::TargetGroup":
if resource_type in ["AWS::ElasticLoadBalancingV2::TargetGroup",
"AWS::ElasticLoadBalancingV2::LoadBalancer"]:
# Target group names need to be less than 32 characters, so when cloudformation creates a name for you
# it makes sure to stay under that limit
name_prefix = '{0}-{1}'.format(stack_name, logical_id)