Open artiphishle opened 1 month ago
Maybe comes due to terraform -install-autocomplete
and not by the installation itself. Just read the supplied stackoverflow link for details, thanks.
Thanks for reporting this, @artiphishle.
Indeed, Terraform will not modify your shell configuration except when running with the -install-autocomplete
option, so that'll be needed for someone to reproduce this. They'll also need to create the right circumstances for that option to decide that it should install for zsh as opposed to any other shell.
Terraform inherits this functionality from upstream dependencies, at two levels:
github.com/hashicorp/cli
provides the API for installing and uninstalling autocompletion settings, which it does in terms of...github.com/posener/complete
's Install
, which has some heuristics for deciding which shells to reconfigurezsh in particular is handled using zsh.install
, which in the latest commit upstream seems to add the following to .zshrc
:
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform
As reported, this does not include autoload -Uz compinit && compinit
. To include that would require a change to the upstream library.
I can't find any existing issue or PR in the github.com/posener/complete
repository, so I expect we'll need to open something there once we've confirmed the problem.
Thanks again!
Terraform Version
Issue & Solution proposal
It's not possible to
source ~/.zshrc
anymore due to:complete:13: command not found: compdef
The solution like mentioned in the stackoverflow link at the bottom to add this line missing:
autoload -Uz compinit && compinit
The whole
.zshrc
content should therefore be:https://stackoverflow.com/questions/66338988/complete13-command-not-found-compdef
Steps to Reproduce
source ~/.zshrc
(or open new terminal)Additional Context
just figured that my
terraform
isn't up-to-date, so the current version isn't available by installing usingbrew
? Just installed 30mins ago, therefore expecting a new version.