New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tab-completion support for PowerShell #29125
Comments
Hi @AjayKMehta! Thanks for this feature request. Terraform's tab-completion is powered by the external library With that said, I should note that we don't currently recommend running Terraform with PowerShell on Windows because PowerShell's handling of quotes when running external programs (rather than PowerShell Cmdlets) is flawed, causing it to send incorrect command lines to Terraform in more complex situations such as input variables on the command line. You can use PowerShell with Terraform for simple commands, so we don't block it entirely, but we do recommend using Windows Command Prompt instead if you are on Windows, in order to avoid PowerShell corrupting the command line you've entered. For that reason, we're unlikely to prioritize implementing PowerShell autocomplete support ourselves, but we'd be happy to include it if the upstream library gains support for it. (PowerShell on Linux and other Unix-like systems probably doesn't have this problem, because the Unix approach for passing arguments from a shell to a program is more compatible with PowerShell's design than that on Windows.) Thanks! |
Thanks @apparentlymart for your informative reply. Yes, PowerShell's handling of of quotes when running external programs leaves much to be desired but it seems there is work being done on that front 🤞 A lot of the other CLI apps I use that are written in Go seem to use cobra which does have support for PowerShell 🙂 |
Hi @AjayKMehta, Unfortunately Terraform was created before Cobra and so it uses other libraries for its CLI layer. We don't have any plans to rebuild it with Cobra, because that would be a lot of work and a lot of risk, with (by our estimation) very little benefit. While I would concede that moving to Cobra would potentially cause autocompletion to work on PowerShell, I'm skeptical that this benefit outweighs the potential cost. On the plus side though, hopefully Cobra's example can illustrate how someone might add similar support to |
Understood. Thanks. I will create an issue in |
@AjayKMehta try this, it will give you some completion w/ tab. Although some of the subcommands that begin with single hypen (-) do not work. This must be related to the bug PowerShell/PowerShell#2912
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Current Terraform Version
Proposal
Please add tab-completion support for PowerShell to
terraform -install-autocomplete
.The text was updated successfully, but these errors were encountered: