-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_route53: HostedZone.fromLookup fails in nested stacks #27249
Comments
Hmm... Three times sounds like we need to do a longer investigation into this. Cross-Account stuff is always hard to manage. Can you produce a Very Minimal (non)working example? |
@indrora the information given is plenty sufficient to reproduce. If you have any specific questions, feel free to ask |
Agh! My apologies, I've just realised that this problem is user error. |
|
Describe the bug
I think this one has been raised and fixed a few times before e.g. #4651, #25171
I have a pipeline stack with stages, pretty similar to what is described in https://docs.aws.amazon.com/cdk/v2/guide/cdk_pipeline.html
This app requires that I lookup some records in an already existing hosted zone.
I can perform HostedZone.fromLookup in the top level stack. The below works:
However, I have a cross account deploy so I need to change environments to lookup a hosted zone in a prod account. So I moved the HostedZone.fromLookup inside my MyPipelineAppStage class, which is called above as a nested stack in the pipelineDevelop.addStage. The below does not work :
The error I get is:
Error: MyPipelineAppStage at 'my-pipeline/my-stage' should be created in the scope of a Stack, but no Stack found
It appears that calling this from the nested Stage stack is breaking the lookup.
Expected Behavior
I expected that HostedZone.fromLookup would work in all stacks, top level and nested.
Current Behavior
HostedZone.fromLookup only works in the top level stack. When I call it in a nested stack, created by pipeline.addStage, it throws an error:
Error: MyPipelineAppStage at 'my-pipeline/my-stage' should be created in the scope of a Stack, but no Stack found
Reproduction Steps
Snippets included in the main description should be enough. The stack looks like:
app
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.96.2 (build 3edd240)
Framework Version
No response
Node.js Version
v18.17.1
OS
WSL... but the error happens in the pipeline in AWS account
Language
Typescript
Language Version
5.2.2
Other information
No response
The text was updated successfully, but these errors were encountered: