terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Google provider: No module named google.google_compute_region_security_policy

Open cyber-francis opened this issue 1 year ago • 2 comments

Expected Behavior

{
"cdktf": "0.20.8",
"providers": {
   "google": "~>6.8.0",
   "google-beta": "~>6.8.0",
  }
}

cdktf get runs perfectly. But, then within my python code, I can't import this lib: from imports.google.google_compute_region_security_policy import GoogleComputeRegionSecurityPolicy

google_compute_region_security_policy exists in the vanilla terraform, but not in cdktf.

Actual Behavior

No module named imports.google.google_compute_region_security_policy

Steps to Reproduce

  1. create a cdktf.json file with below parameters:
{
"cdktf": "0.20.8",
"providers": {
   "google": "~>6.8.0",
   "google-beta": "~>6.8.0",
  }
}
  1. cdktf get
  2. from imports.google.google_compute_region_security_policy import GoogleComputeRegionSecurityPolicy

Versions

google@~>6.8.0 google-beta@~>6.8.0 cdktf-cdktf-provider-google: terraform provider version: 5.36.0, prebuilt provider version: 13.25.0

Providers

No response

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

  • [ ] I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cyber-francis avatar Oct 25 '24 14:10 cyber-francis

It seems like you have the google provider in your cdktf.json as well as the pre-built provider in your project. This is normally not what you want to do, you should either remove the local one or the pre-built one.

Other than that I do believe for resources the imports omit the provider name, so the import would be from imports.google.compute_region_security_policy import ComputeRegionSecurityPolicy

DanielMSchmidt avatar Nov 04 '24 07:11 DanielMSchmidt