I am getting error while using cdktf synth command:
AwsProvider(self, ‘aws’, region=‘us-west-1’ )
NameError: name ‘self’ is not defined
I am getting error while using cdktf synth command:
AwsProvider(self, ‘aws’, region=‘us-west-1’ )
NameError: name ‘self’ is not defined
Hi!
I suspect you are using Python?
Could you share a bit more from your the code you are using that produces this error?
Ansgar
#!/usr/bin/env python
from constructs import Construct
from cdktf import App, TerraformStack
from imports.aws import AwsProvider
class MyStack(TerraformStack):
def init(self, scope: Construct, ns: str):
super().init(scope, ns)
AwsProvider(self, 'aws', region='us-west-1')
app = App()
MyStack(app, “youtubecdkdemo”)
This is the code I am working
I added provider package and has AwsProvider class in it , However , I am still facing issue. Also in pycharm i can also see this message:
Unresolved reference ‘AwsProvider’
Inspection info: This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.
thanks my issue has been fixed.
@alexsunny734 @gambhir87 how did you resolve the reference issue in your IDE?
I’m running into the same issue using both the generated provider and pre-built (cdktf-provider-google) libs.
Okay, after some digging, I’ve found that this is a known issue with the generated code and IntelliJ / Jetbrains IDEs.
There is a similar open issue (at time of this comment) for the AWS CDK where when the file size is larger than the IDE’s default size for Intellisense, it causes the IDE not to analyze the file.
Workaround for increasing the default file size: Configure file size limits | JetBrains Rider
I ended up setting the property to 25000 since the generated file ended up being ~23 MB.
Hope this helps the next person!
I love you with all my soul