How to use FnImportValue where CDK wants a string or list of string?
See original GitHub issueHi,
I’m trying to import a VPC from an existing (non-cdk) stack, following the examples in: https://gist.github.com/mipearson/aeaf303b0770c25f8b5f6e360594cfbf https://github.com/awslabs/aws-cdk/issues/603 https://github.com/awslabs/aws-cdk/issues/506
I added exports in my existing stack for the VPC ID, CIDR block, availability zones, and subnets.
In order to call VpcNetworkRef.import_
, I need to pass it VpcNetworkRefProps, and the builder for the props wants a list of strings for AZs.
None of these type check as arguments to VpcNetworkRefProps.builder().withVpcId(id).withAvailabilityZones
:
new FnImportValue("other-stack-AZs")
whereother-stack-AZs
is a comma-separated export (Fn::Join
on the other stack’s cloudformation template)new FnSplit(",", new FnImportValue("other-stack-AZs"))
[new FnImportValue("other-stack-AZ1"), new FnImportValue("other-stack-AZ2"), new FnImportValue("other-stack-AZ3")]
How can I import availability zones from another stack?
And more generally, how should we use FnImportValue where CDK wants a string or a list of strings?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Fn::ImportValue - AWS CloudFormation
You can use the intrinsic function Fn::ImportValue to import only values that have been exported within the same region. For outputs, the value...
Read more >How to export and import stack output values in CDK?
To import those values, we use the `Fn::ImportValue` function in the template for the other stacks. ... Construct, id: string, props?: cdk.
Read more >Fn::ImportValue - Amazon CloudFormation - 亚马逊云科技
The intrinsic function Fn::ImportValue returns the value of an output exported by another stack. You typically use this function to create cross-stack ...
Read more >Cross-stack reference - AWS CloudFormation p3.7 - YouTube
Welcome to part 3.7 of this tutorial series on AWS CloudFormation. In this tutorial, I have covered the intrinsic function Fn :: ImportValue...
Read more >Import Stack Outputs in AWS CDK for Cross Stack References
In order to import a value that was exported from another stack, we have to use the `importValue` static method on the `Fn`...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think we need a general-purpose solution, just support for string arrays.
We could extend Token stringification to have different encodings for different types… but the types would have to be known beforehand which we also don’t have.
With the type system that we have, not much we can do I think.