Skip to content

CDKTF CLI: CLI hangs if in interactive input is required during CDKTF commands #3041

Open
@OliverWessels

Description

@OliverWessels

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 #398 where the CLI hangs because it never displays a prompt and receives input from the user.

Steps to Reproduce

  1. Set up the CDKTF CLI with TypeScript
  2. Create a Terraform module in a .tf file e.g. something like module "my_module" { ... } with source set to a git repository that contains a source module (https://developer.hashicorp.com/terraform/language/modules/sources#generic-git-repository)
  3. Remove the repository from ~/.ssh/known_hosts so that you will be prompted to confirm that you trust the repo.
  4. Run 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

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/has-workaroundA bug with a workaround (may not be elegant)priority/backlogLow priority (though possibly still important). Unlikely to be worked on within the next 6 months.size/mediumestimated < 1 weekux/cli

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions