I need to pass INamespace to CloudMapOptions in order that the ECS tasks register to the AWS CloudMap, I get following error. I can't decouple them with CfnOutput, because I need the namespace in the ECS cloudMapOptions:
Stack "users" cannot consume a cross reference from stack "servicediscovery". Cross stack references are only supported for stacks deployed to the same environment or between nested stacks and their parent stack.
I tried this : https://bobbyhadz.com/blog/aws-cdk-share-vpc-between-stacks, but without any success. How can I pass a variable of type INamespace between stacks?
This error likely happens if you do one of the following:
Note that such cross region references are not supported
StackProps
as 3rd parameter to Stack
constructorIn order to resolve that please make sure to pass the same env
value in StackProps
e.g.
class MyStack extends Stack {
constructor(scope: Construct){
super(scope, "MyStack", {
env: {
account: '123456789',
region: 'eu-central-1'
}
})
}
}