My English may be strange. If there are places where it doesn't make sense, please ask me.
What we want to achieve
I want to build an environment using aws cdk(python). I want to separate the vpc stack from the aurora stack. To do this, I want to add a resource (subnet id) created on vpc's stack to aurora's I want to reference it in the stack.
problem
#!/usr/bin/env python3
from aws_cdk import core
from test.aurora import auroraStack
from test.vpc import vpcStack
app = core.App()
prod = core.Environment(account="123456789012", region="us-east-1")
vpcStack(app, "Vpc", env=prod)
auroraStack(app, "Aurora", env=prod, sbntid=vpcStack.outputSbnt01)
app.synth()
I've written the code based on the ↓ document, but I get an error when I run it.
https://docs.aws.amazon.com/cdk/latest/guide/resources.html#resource_stack
I have confirmed that I will deploy with vpcStack, auroraStack only . However, I get the following error. AttributeError: The 'vpcStack' object has no attribute 'outputSbnt01'
What I've tried
I tried it and set outputSbnt01 in Cfnoutput, but I get the same error. There is a similar question ↓ and I tried, but I got the same error.
AWS CDK: how do I reference cross-stack resources in same app?
Thanks for watching.