I am trying to create environment agnostic app via cdk. The app consists of EC2 with Load balancer and few other aws services. The objective is to automate the process of deployment of the stack in various AWS accounts via jenkins pipelines.
Currently, we have different VPC in each AWS account with different tags. This is getting complex here as how should I make the code, so that it can fetch and use VPC value from the account the cdk code is deployed ?
I tried using vpc as parameter but its not working. What is the best way to do this without hardcoding vpc id or vpc name ?
const vpcparam = new CfnParameter(this, 'VPCParam', {
type: 'String',
description: "Enter the VPC ID ",
}
)
// Allocate to Stack
const vpcId = ec2.Vpc.fromLookup(this, 'VPC', {
vpcId: vpcparam.valueAsString
})
Error All arguments to Vpc.fromLookup() must be concrete (no Tokens) Subprocess exited with error 1