Terraform Commands fail when no provider version is specified
See original GitHub issueCommunity 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
all
Affected Resource(s)
Provider requirements
Debug Output
$(yarn bin)/cdktf diff
⠸ initializing typescript-vault...
Error: Invalid provider version constraint
Invalid version constraint "undefined" for provider vault.
Error: Invalid version constraint
on cdk.tf.json line 10, in terraform.required_providers:
10: "vault": "undefined"
This string does not use correct version constraint syntax.
non-zero exit code 1
Expected Behavior
When specifying a cdktf.json
file like this:
{
"language": "typescript",
"app": "npm run --silent compile && node main.js",
"terraformProviders": [
"vault"
]
}
I’d expect it to work properly for all cli comands.
Actual Behavior
diff
/ deploy
/ destroy
are broken
Steps to Reproduce
- Specify
cdktf.json
file as described above - run
cdktf get
- run
cdktf diff
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Lock and Upgrade Provider Versions | Terraform
Manage your provider versions using the dependency lock file. Use version constraints to filter provider versions compatible with your configuration.
Read more >what happens if provider version constraint is not specified in ...
The most likely thing that is going to happen is that your terraform plan or terraform apply will fail since some resource attribute...
Read more >Troubleshooting the Terraform Provider - Oracle Help Center
Use the following command to check your Terraform provider version. The OCI Terraform provider documentation reflects the latest version.
Read more >Terraform Providers Overview - How To Use Them & Examples
The providers are specified in the Terraform configuration code. ... version and alias . version is deprecated and should no longer be used, ......
Read more >Configuring Terraform and the provider version to use
With regard to the specification of the provider version, when executing the terraform init command, if no version is specified, Terraform downloads the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danieldreier in fact your proposal in #877 will help a lot and i agree to your points. Basically this is what i also suggested but as an extension to the existing
cdk get
. However having an install command and getting rid of manually editingcdktf.json
is a more elegant way IMHO.It’s unclear to me whether users (please chime in!) actively oppose dependency pinning, but my impulse here is to see this as a UX problem resulting from us requiring users to manually edit
cdktf.json
to specify providers.Based on my experience in Terraform Core, using providers that aren’t pinned to at least a general range basically inevitably (eventually) results in an unplanned pain when a backwards-incompatible provider release happens.
I’m inclined to fix this with a UX more like what I proposed in https://github.com/hashicorp/terraform-cdk/issues/877 and avoid users needing to edit
cdktf.json
under normal circumstances. Alternatively, we could rely on the Terraform dependency lock file but I think we’re signing people up for a problem down the road if we equate a missing version string to latest.