bug(ec2): Endpoint service AZ lookup fails for InterfaceVpcEndpointAwsService #8372
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
bug
This issue is a bug.
in-progress
This issue is being actively worked on.
needs-triage
This issue or PR still needs to be triaged.
p1
This bug is a case that wasn't caught in testing of #7521 - if the provided service name has tokens in it, synthesis fails with the error:
InterfaceVpcEndpointAwsService objects have tokens in their name which makes them unusable with this functionality.
In this case the serviceName ends up being something like:
com.amazonaws.${Token[AWS::Region.4]}.execute-api
Reproduction Steps
Create an InterfaceVpcEndpoint, with the service being an InterfaceVpcEndpointAwsService, and synthesize the template.
Below is the code that defines the name. InterfaceVpcEndpointAwsService are region-agnostic, which is why they have a token in the name. Unfortunately this breaks AZ lookup for these services.
aws-cdk/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts
Line 317 in a4797b4
Error Log
Environment
Other
My proposed solution would be to resolve the AWS.Region token in the InterfaceVpcEndpoint class, before doing the lookup. The AZ lookup already requires the account and region to be set, so we will know the region in advance.
I am not sure how to resolve an AWS.Region token. I've tried using the
resolve
functionality in the Stack class, but it doesn't return the region, just an object:This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: