hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.83k stars 449 forks source link

Document transition between generated and pre-built providers #831

Open jsteinich opened 3 years ago

jsteinich commented 3 years ago

Hmm, that doesn't seem to be enough for cdktf:

[Container] 2021/06/23 14:35:58 Running command cdktf synth
ERROR: synthesis failed, run "cdktf get" to generate providers in imports

If I execute the Python script directly instead:

[Container] 2021/06/23 14:41:42 Running command pipenv run ./main.py
Traceback (most recent call last):
  File "/...../main.py", line 4, in <module>
    from imports.aws import AwsProvider
ModuleNotFoundError: No module named 'imports'

This happens because the Python script references the generated imports folder. I can address this by replacing from imports.aws import AwsProvider, ... with from cdktf_cdktf_provider_aws import AwsProvider, ... - looks a bit awkward, but I suppose it's intended that way?

Originally posted by @onitake in https://github.com/hashicorp/terraform-cdk/issues/791#issuecomment-866930714

onitake commented 3 years ago

@jsteinich Did you intend to create a new issue from this comment? If yes, I'll cross-post some more context here. I can also open a new issue.

ansgarm commented 3 years ago

As Jon added labels I think it was on purpose 😄 If the context is related to improving the documentation (as tagged) it would be useful here – if there are things to fix instead, I'd say file a new bug 👍

For either way: Thank you for contributing!

jsteinich commented 3 years ago

Yep, definitely intentional. I think improving cdktf get performance is a standalone issue and anything else that has come up while working around it should be separate. @onitake as I understood the issues you ran into where windows/linux path problems and needing to update imports when switching to pre-built. If there were other problems, please file as separate issues.