Greetings,
I am following these directions for python:
But every time I try cdk deploy, I get this error:
POC_Python_terraform % cdktf deploy
⠇ Synthesizing
[2022-10-05T08:32:18.310] [ERROR] default - File "/Users/matt/Repos/Cloud%20Operations/POC_Python_terraform/main.py", line 20
)TypeError: 'module' object is not callable
^
ERROR: cdktf encountered an error while synthesizing
Synth command: pipenv run python main.py
Error: non-zero exit code 1
Command output on stderr:
File "/Users/matt/Repos/Cloud%20Operations/POC_Python_terraform/main.py", line 20
)TypeError: 'module' object is not callable
^
SyntaxError: invalid syntax
⠼ Synthesizing
I decided to take out the TerraformOutput segment to just test it, and I now I get a different error:
POC_Python_terraform % cdktf deploy
⠹ Synthesizing
[2022-10-05T08:33:51.375] [ERROR] default - Traceback (most recent call last):
File "/Users/matt/Repos/Cloud%20Operations/POC_Python_terraform/main.py", line 4, in <module>
from cdktf_cdktf_provider_aws import AwsProvider, ec2
ImportError: cannot import name 'AwsProvider' from 'cdktf_cdktf_provider_aws' (/Users/matt/.local/share/virtualenvs/POC_Python_terraform-2Corphkz/lib/python3.9ERROR: cdktf encountered an error while synthesizing
Synth command: pipenv run python main.py
Error: non-zero exit code 1
Command output on stderr:
Traceback (most recent call last):
File "/Users/matt/Repos/Cloud%20Operations/POC_Python_terraform/main.py", line 4, in <module>
from cdktf_cdktf_provider_aws import AwsProvider, ec2
ImportError: cannot import name 'AwsProvider' from 'cdktf_cdktf_provider_aws' (/Users/matt/.local/share/virtualenvs/POC_Python_terraform-2Corphkz/lib/python3.9/site-packages/cdktf_cdktf_provider_aws/__init__.py)
I dig around and tried adding the following to my cdktf.json file:
"terraformProviders": ["aws@~> 4.0"],
and did a ‘cdktf get’, however, I still get the same error. Any help is appreciated.
Thanks,
Matt