cloudtools / cloudtools/troposphere

AWS::ElasticLoadBalancingV2::LoadBalancer can not use AWSHelperFn for Subnets and SecurityGroups

Open
#1,773 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

The 2020-06-11 change to Troposphere changed props for AWS::ElasticLoadBalancingV2::LoadBalancer SecurityGroups and Subnets from:

`'Subnets': (list, False),` -- to --> `'Subnets': ([basestring], False),`

https://github.com/cloudtools/troposphere/commit/4d404fafd001f3d01c4bbd2dc322d143f5975143

If you create a `troposphere.elasticloadbalancingv2.LoadBalancer` using `from_dict` the `_from_dict` validation is now triggered to check for a List. However, if you are using a AwsHelperFn such as a Troposphere.Ref for `List` and `List` then validation will incorrectly fail.

Changing `BaseAWSObject._from_dict` from:

`if isinstance(prop_type, list):`

To

`if isinstance(prop_type, list) and not isinstance(value, AWSHelperFn):`

Fixes the problem by skipping validation on AWSHelperFn's. Basically bringing the validation in-sync with the behaviour of the `BaseAWSObject.__setattr__` method.

Not sure if there are other considerations that change might have though ...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.