question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terraform Commands fail when no provider version is specified

See original GitHub issue

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

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:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PacoVKcommented, Sep 11, 2021

@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 editing cdktf.jsonis a more elegant way IMHO.

1reaction
danieldreiercommented, Sep 10, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found