terraform-cdk
terraform-cdk copied to clipboard
CLI: provider generation fails on versions newer than 0.20.1
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
- Create a typescript cdktf project.
- Install
cdktf-cliwith version0.20.1or lower. - Run
cdktf provider add grafana/grafana. - Reset
- Create a typescript cdktf project.
- Install
cdktf-cliwith version0.20.2or higher. - 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