In the process of creating two stacks, I aim to reference the resources from the first stack, such as Lambda, API Gateway, and DynamoDB, in the second stack without hard coding all the resources using Stack Props. Please note: I do not want to use Stack Props to manually input all the resources into the second stack. For example: File 1
export class StackOne extends cdk.Stack {
constructor(scope: Construct, id: string, props: StackOneProps) {
super(scope, id, { env: props.env });
const lambda1 = new lambda.Function();
const lambda2 = new lambda.Function();
const api = new apigateway.RestApi()
new apigateway.LambdaIntegration(
lambda1
);
new apigateway.LambdaIntegration(
lambda2
);
}
}
File 2
export class StackTwo extends cdk.Stack {
constructor(scope: Construct, id: string, props: StackTwoProps) {
super(scope, id, { env: props.env });
const StackOne = //Acquire the StackOne Reference
StackOne.Resourcs.forEach(rsourcs ==> {} )
}
}