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

CLI: provider generation fails on versions newer than 0.20.1

Open glacion opened this issue 9 months ago • 0 comments

Expected Behavior

cdktf provider add grafana/grafana completes successfully with the following log:

[2025-01-17T13:33:51.101] [INFO] default - Checking whether pre-built provider exists for the following constraints:
  provider: grafana/grafana
  version : latest
  language: typescript
  cdktf   : 0.20.11

[2025-01-17T13:33:51.466] [INFO] default - Pre-built provider does not exist for the given constraints.
[2025-01-17T13:33:51.467] [INFO] default - Adding local provider registry.terraform.io/grafana/grafana with version constraint undefined to cdktf.json
Local providers have been updated. Running cdktf get to update...
Generated typescript constructs in the output directory: src/gen

Actual Behavior

On cdktf-cli versions higher than 0.20.1 this command fails with the following:

[2025-01-17T13:35:11.795] [INFO] default - Checking whether pre-built provider exists for the following constraints:
  provider: grafana/grafana
  version : latest
  language: typescript
  cdktf   : 0.20.11

[2025-01-17T13:35:12.171] [INFO] default - Pre-built provider does not exist for the given constraints.
[2025-01-17T13:35:12.171] [INFO] default - Adding local provider registry.terraform.io/grafana/grafana with version constraint undefined to cdktf.json
Local providers have been updated. Running cdktf get to update...
⠋ starting...
[2025-01-17T13:35:12.833] [INFO] default - The CDKTF version has changed, generating all cons
Error: Could not find provider with constraint {"constraint":{"name":"grafana","fqn":"grafana","version":"~> 3.16","source":"grafana/grafana","namespace":"grafana"},"targetLanguage":"typescript","fileName":"providers/grafana/index.ts"}
    at HT.generate (/Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:111:13762)
    at Ane.generateTypescriptProvider (/Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:114:84132)
    at Ane.generateTypescript (/Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:114:86199)
    at /Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:117:618
    at Array.map (<anonymous>)
    at Ane.generate (/Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:117:606)
    at async YUe (/Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:197:3611)
    at async /Users/glacion/Source/infrastructure/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:519:16936
⠙ downloading and generating modules and providers...
Error: Could not find provider with constraint {"constraint":{"name":"grafana","fqn":"grafana","version":"~> 3.16","source":"grafana/grafana","namespace":"grafana"},"targetLanguage":"typescript","fileName":"providers/grafana/index.ts"}
error: "cdktf" exited with code 1

Steps to Reproduce

  1. Create a typescript cdktf project.
  2. Install cdktf-cli with version 0.20.1 or lower.
  3. Run cdktf provider add grafana/grafana.
  4. Reset
  5. Create a typescript cdktf project.
  6. Install cdktf-cli with version 0.20.2 or higher.
  7. Run cdktf provider add grafana/grafana.

Versions

language: typescript cdktf-cli: 0.20.11 node: v20.18.1 cdktf: 0.20.11 constructs: 10.4.2 jsii: null terraform: 1.8.4 arch: arm64 os: darwin 24.2.0

Providers

┌───────────────────────┬──────────────────┬─────────┬────────────┬──────────────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────────────┼──────────────────┼─────────┼────────────┼──────────────────────────────┼─────────────────┤ │ grafana/grafana │ │ │ ~> 3.16 │ │ │ ├───────────────────────┼──────────────────┼─────────┼────────────┼──────────────────────────────┼─────────────────┤

Gist

No response

Possible Solutions

No response

Workarounds

Pin cdktf-cli version to 0.20.2

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

glacion avatar Jan 17 '25 10:01 glacion