I am trying to create an AWS Gateway Load Balancer configuration in AWS CDK (python). I already have a working version in Cloud Formation. The synth step is failing, seemingly, because CDK is not recognizing a "list" as a Sequence.
Below is the key bit of python. Note that I'm using L1 constructs since there do not yet seem to be L2 constructs for GWLB.
gwlb = elbv2.CfnLoadBalancer(
self,
"GatewayLoadBalancer",
name=f"GWLB-{self.stack_name}",
type="gateway",
subnets=gwlb_subnet_ids,
scheme="internal",
load_balancer_attributes=[
elbv2.CfnLoadBalancer.LoadBalancerAttributeProperty(
key="load_balancing.cross_zone.enabled", value="true"
)
],
)
gw_endpoint_service = ec2.CfnVPCEndpointService(
self,
"VPCEndpointService",
acceptance_required=False,
gateway_load_balancer_arns=[gwlb.get_att("Arn")],
)
When I run the synth, I get this error:
File "/Users/pmryan/.pyenv/versions/3.8.12/lib/python3.8/site-packages/typeguard/__init__.py", line 757, in check_type
checker_func(argname, value, expected_type, memo)
File "/Users/pmryan/.pyenv/versions/3.8.12/lib/python3.8/site-packages/typeguard/__init__.py", line 558, in check_union
raise TypeError('type of {} must be one of ({}); got {} instead'.
TypeError: type of argument gateway_load_balancer_arns must be one of (Sequence[str], NoneType); got list instead
Wondering if this is a CDK bug. In every other CDK construct, I can pass a python list to an argument that expects a Sequence.