Open OliverWessels opened 11 months ago
That's an unfortunate bug, I think as a workaround you could use e.g. git submodule to download the module and reference it as a local module in your cdktf.json
file.
Thanks for the suggestion @DanielMSchmidt! One other thing I forgot to mention is that we reference different tags of the git repo e.g. using ?ref=7.1.1
and ?ref=7.2.0
, so I think we'd have to to something like checking out each different tag, or cloning the target repo, including tags, and then reference it with git locally somehow (I haven't tried this, would need to dig into feasibility).
I think it would still be good to address the root cause, in case anything else needs an interactive input during CDKTF commands (e.g. the linked issue about hanging on terraform input).
@OliverWessels I stumbled upon a similar issue with cdktf login
or cdktf init
and we need standard input (say terraform cloud api token).
What worked for me is the following:
cat "your-standard-input" | cdktf login
I created an issue here: https://github.com/hashicorp/terraform-cdk/issues/3470 Planning on raising a fix, hopefully soon
Expected Behavior
If a module references a git repository for its source (https://developer.hashicorp.com/terraform/language/modules/sources#generic-git-repository), you may be be prompted during CDKTF commands to enter a passphrase for your SSH key or add to the list of known hosts if you have not cloned from that repo before.
Running a command such as
yarn run cdktf get
(with CDKTF set up for an npm package) should pause and show the input prompts to the user.Actual Behavior
The input prompts do very briefly appear (for maybe a single frame) but then get written over by the line
downloading and generating modules and providers...
. Trying to type in values does not work either. The CLI hangs as a result.This appears similar to https://github.com/hashicorp/terraform-cdk/issues/398 where the CLI hangs because it never displays a prompt and receives input from the user.
Steps to Reproduce
.tf
file e.g. something likemodule "my_module" { ... }
withsource
set to a git repository that contains a source module (https://developer.hashicorp.com/terraform/language/modules/sources#generic-git-repository)~/.ssh/known_hosts
so that you will be prompted to confirm that you trust the repo.yarn run cdktf get
Versions
language: typescript cdktf-cli: 0.16.3 node: v19.9.0 cdktf: 0.16.3 constructs: 10.2.43 jsii: null terraform: 1.4.6 arch: arm64 os: linux 5.15.49-linuxkit
Providers
We are using SignalFX provider
6.24
and a provider for our own in-house tool. However this is not provider-specific because the CLI is hanging before reaching anything provider-specific.Gist
No response
Possible Solutions
I suspect that the CDKTF CLI is not properly passing along stdin / allowing the process to pause and receive input from the user.
Workarounds
I had to manually run SSH commands before CDKTF, e.g. to try and prevent the case where CDKTF needs input mid-way through. There are still cases where this is not possible though.
Anything Else?
No response
References
Help Wanted
Community Note