Terraform autocompletion not working on macOS with default zsh shell

Problem solved thanks to the awesome @alisdair!

Looks like the install-autocorrect script could do with a check to see if the following line is present in .zshrc or not:

autoload -Uz compinit && compinit

Proposed a change to the zsh.go script in @posener 's complete library that Terraform depends on: posener/complete#124
Added check for the autoload -Uz compinit && compinit line in zsh.go.

For anyone else looking to solve this problem, here is my full working .zshrc :

autoload -U +X bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -o nospace -C /usr/local/bin/terraform terraform
8 Likes