Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level
See original GitHub issueNote: for support questions, please first reference our documentation, then use Stackoverflow. This repository’s issues are intended for feature requests and bug reports.
-
I’m submitting a …
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior? When trying to use ec2.Vpc.fromLookup, and passing { env: { region: “your-region”, account: “your-account-id”} } I get and error when doing
cdk list
: Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level Link to code: https://gist.github.com/mrcustard/828242e3e5b8786776fd0c78d1e74e63 -
What is the expected behavior (or behavior of feature suggested)? I would expect to be able to lookup the vpc and get ec2.IVPc returned
-
Please tell us about your environment:
- CDK CLI Version: 0.36.0 (build 6d38487)
- Module Version: 0.36.0
- OS: OSX Mojave
- Language: TypeScript
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:11 (3 by maintainers)
Top GitHub Comments
In case someone runs into this problem and made the same mistake as me. (@niels1voo it looks like you might have). I had been constructing my own stack and properly passing in the env. But I used the boilerplate and it had its own stack in
bin/project-name.ts
that was making a stack. I didn’t realize that. Instead of making my own stack, I edited that one to include an environment. That made everything work.@kaihendry you do not have to set these variables. They are set by CDK but you have to use them in den StackProps.