terraform-cdk
terraform-cdk copied to clipboard
Convert: init-from-terraform-project fails with unknown provider
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
cdktf & Language Versions
Affected Resource(s)
Debug Output
When I convert a project with unknown provider versions we seem to use " *" as a default
There are some problems with the configuration, described below.
The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
╷
│ Error: Invalid version constraint
│
│ on main.tf.json line 1, in terraform.required_providers.random:
│ 1: {"terraform":{"required_providers":{"random":{"version":" *","source":"random"},"tls":{"version":" *","source":"tls"},"aws":{"version":" ~> 4.15.1","source":"hashicorp/aws"}}},"provider":{"random":{},"tls":{},"aws":{}}}
│
│ This string does not use correct version constraint syntax.
╵
Expected Behavior
Actual Behavior
Steps to Reproduce
Important Factoids
References
- #0000
I ran into this also.
Many of the providers which I directly depended on via required_providers, in turn depended on hashicorp/random. So I had an indirect dependency on hashicorp/random.
I was able to unblock myself by explicitly depending on a specific version of hashicorp/random by adding it to my required_providers. To determine which version I should use, I looked in ./terraform/providers/registry.terraform.io/hashicorp/random to see which version was installed.
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.