Skip to content
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-ec2] Python: Cannot retrieve value from context provider vpc-provider #9477

Closed
yohei1126 opened this issue Aug 6, 2020 · 3 comments
Closed
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud guidance Question that needs advice or information. language/python Related to Python bindings response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@yohei1126
Copy link

yohei1126 commented Aug 6, 2020

Importing an existing VPC did not work.

Reproduction Steps

MyStack(
    app,
    "airflow",
    env=core.Environment(account="98765432", region="ap-southeast-1")
)
  • use from_lookup.
from aws_cdk import aws_ec2
class MyStack(core.Stack):
    def __init__(self, app: core.App, id: str, **kwargs) -> None:
        super().__init__(app, id, **kwargs)
        vpc = aws_ec2.Vpc.from_lookup(self, "vpc", vpc_id="vpc-xxx")

What did you expect to happen?

  • the existing VPC is imported to the CloudFormation stack

What actually happened?

jsii.errors.JSIIError: Cannot retrieve value from context provider vpc-provider since account/region are not specified at the stack level. Either configure "env" with explicit account and region when you define your stack, or use the environment variables "CDK_DEFAULT_ACCOUNT" and "CDK_DEFAULT_REGION" to inherit environment information from the CLI (not recommended for production stacks)

Environment

  • CLI Version : 1.56.0 (build c1c174d)
  • Framework Version: 1.54.0
  • Node.js Version: v12.18.3
  • OS : Windows 10
  • Language (Version): Python 3.7.3

Other


This is 🐛 Bug Report

@yohei1126 yohei1126 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 6, 2020
@SomayaB SomayaB changed the title [aws_ec2] Python: Cannot retrieve value from context provider vpc-provider [aws-ec2] Python: Cannot retrieve value from context provider vpc-provider Aug 6, 2020
@SomayaB SomayaB added the language/python Related to Python bindings label Aug 6, 2020
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Aug 6, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 10, 2020

Please create a simple GitHub repository that reproduces this issue, because I cannot reproduce it.

@rix0rrr rix0rrr added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. guidance Question that needs advice or information. and removed bug This issue is a bug. labels Aug 10, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Aug 10, 2020
@yohei1126
Copy link
Author

Looks like small example does not reproduce the issue.

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 11, 2020

Then there is something different between the small example and the application in which you are observing this issue.

It's up to you to find what the difference is, we cannot do that for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud guidance Question that needs advice or information. language/python Related to Python bindings response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants