Terraform’s “autocomplete” support is implemented in terms of a third-party library, which is where this error message originates. From looking at the source code of that library I see that its strategy is to search for a number of possible shell configuration files to add its configuration to:
It seems that the error you saw results from this function not finding any of the files it is searching for. Since you said you are using bash I think the series of bash configuration files are the most relevant for you:
You should then have an empty file .bashrc in your home directory. If you then run terraform -install-autocomplete again, it should hopefully find that file and append the Terraform autocomplete setup code to it, and then after you restart the shell it should take effect.
On Unix systems an initial .bashrc (or similar) file is typically created when adding a new user to the system, so I think the autocomplete library is surprised to encounter a situation where you have no configuration file at all.
If anyone is experiencing this on Mac and is using bash instead of zsh then note that you need a ~/.bash_profile file. Having a ~/.bashrc file is not sufficient as this tool only looks for bash_profile file on mac.
Hi all, I’m running into this issue and the previous fixes have not worked for me unfortunately.
I’m on Windows 10, running cygwin for a unix-like terminal. It uses bash. I’m in my home directory, and confirmed that .bashrc (and .bash_profile) exist. I’ve tried changing permissions on .bashrc, temporarily deleting it, touching a blank file. Regardless, I always get the same error:
$ terraform -install-autocomplete
Error executing CLI: Did not find any shells to install
I looked at the install.go script - I’m not familiar with the language, but I agree that it seems to just be searching for files named .bashrc, etc.
My best guess was that when terraform runs, it is looking somewhere other than my home for .bashrc and not finding it. But I even tried moving the terraform.exe to my home temporarily, and executing from there, and it still gives the same issue.
I would greatly appreciate any troubleshooting tips if anyone has any I’m stumped.