-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk/ec2 token resolve issues #3104
Comments
@NGL321 do I need to provide an example other than the code snippet I provided? |
@cmckni3 That looks like it should be sufficient for repro, thank you for asking! I'll let you know if I need any more information as soon as I am able to look into this in more depth! |
Not sure that your use case (deploy-time resolution of a list of subnet IDs) is going to work. There are some cases in which we need to know the number of availability zones at the time CDK code is executing, for example, and given that this construction makes it so that the AZs are only known at deploy time, that can never work properly. We would recommend doing the lookup at CDK execution time rather than CloudFormation deployment time. Now, it might be that for your use case, you won't hit any of the problematic code paths, so you might still want to proceed with your approach. The immediate issue you're hitting is that Converting to a list token will stop that from happening: availabilityZones: [...Token.asList(Fn.findInMap(accountResourceMapping.logicalId, this.accountId, 'vpcAvailabilityZones'))], Closing this issue. If you feel this is closed in error, please reopen. |
Thanks! That's what I needed. I am doing the lookup at CDK execution time. |
Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.
I'm submitting a ...
What is the current behavior?
If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
I am using
Fn.findInMap
to resolve availability zones and private subnets to create a vpc. Problem arises from the use of tokens. For some reason, the subnet token is not resolved correctly and is placed into the synthesized template as an array of each character of the token name.Another problem arises from the use of
Token
it seems. I can place the literal array with subnet ids forprivateSubnetIds
but then I get an error thatprivateSubnetIds
(2) must a multiple of availability zones (18). I only have 2 availability zones. I believe.length
is called on the Token string itself which is of form the${Token[Token.89]}
.Should resolve the availability zone and private subnet ids as string arrays.
Using this to deploy multiple environments.
Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
Might be related to #168?
#817
The text was updated successfully, but these errors were encountered: