env parameter of cdk.Stack constructor seems to be ignored
See original GitHub issueDescribe the bug
env
parameter of cdk.Stack
constructor seems to be ignored. Apologies if I overlooked something obvious.
To Reproduce
-
Initialize a new python CDK project
cdk init --language python
-
./cdk_test/cdk_test_stack.py: initialize any construct/resource in the sample stack class; e.g.
sns.Topic(self, 'CdkTestTopic')
-
app.py: initialize the stack with an explicit region that differs from your default; e.g.
app = cdk.App()
env = cdk.Environment(region='us-east-2')
stack = CdkTestStack(app, 'my-cdk-test', env=env)
Expected behavior Relevant cdk commands that interact with CloudFormation (e.g., diff, deploy, destroy, etc.) should operate on the region specified above in app.py. In my case, they did not.
Version:
- OS: cpe:/o:fedoraproject:fedora:30
- Programming Language: Python 3.7.3
- CDK Version: 0.34.0 (build 523807c)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Troubleshooting common AWS CDK issues
When deploying my AWS CDK stack, I receive a NoSuchBucket error. Your AWS environment has not been bootstrapped, and so does not have...
Read more >awslabs/aws-cdk - Gitter
With a solution like this I'm getting errors when instantiating a stack because of naming collisions: Error: There is already a Construct with...
Read more >AWS CDK parameter error: Value of property ...
In a nutshell, it looks like a bug in the CDK. The CDK tries to send an array as a parameter to the...
Read more >AWS CDK Toolkit
Deploys a stack of your CDK app to its environment. During the deployment, the toolkit will output progress indications, similar to what can...
Read more >Infrastructure Tests with CDK
Stack { constructor(environment: string, scope: cdk. ... here is that each test only tests the properties specified and ignores the rest, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is discussed in #2866 - by the way, a temporary fix should be already present (line 515) here) … but I didn’t understand exactly why it doesn’t work 🤔
Just for future googlers - I just bumped into this on CDK 2.8. I was referencing the region/account passed in via
env
asself.env.region
in my stack. Turns out that you need to reference them asself.region
! Took me a few minutes to work out, doh!