terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Support for tab completion in `terraform console`

Open dustindortch opened this issue 5 years ago • 2 comments

Current Terraform Version

0.14.3

...

Use-cases

When working in terraform console traversing a complex data structure can be eased by being able to tab complete keywords and known variables/properties, etc.

Attempted Solutions

Proposal

Add tab completion.

References

dustindortch avatar Dec 25 '20 19:12 dustindortch

Hi @dustindortch! Thanks for sharing this use-case.

I want to be transparent with you that the terraform console command is not a focus for us right now and implementing what you've requested here would likely amount to a significant rewrite of its UI layer, because the current implementation is just a straightforward readline-like without any hooks for implementing features like tab completion. While it would be very nice to have tab completion in terraform console, I expect we wouldn't be able to prioritize it in the near future, both because of the direct implementation effort and because switching to a new input implementation for the console would risk creating unrelated regressions.

With that said, a while back I was experimenting with an interactive prompt for HCL-based expressions (which is what Terraform expressions are too), in my own repository hclcalc. It's not production-ready by any means, but it is perhaps a proof-of-concept of a future implementation of terraform console that has autocomplete behavior, at least for simple cases. For more complex situations we'd probably end up needing to borrow behaviors from the Terraform language server, which would be much more involved.

apparentlymart avatar Jan 08 '21 01:01 apparentlymart

Any update on this?

for now, It can be done via https://github.com/paololazzari/terraform-repl

Horkyze avatar Oct 07 '24 16:10 Horkyze