How to get shell completions for Terraform?

I’m trying to setup Terraform shell completions in NixOs, but there’s something funny going on. The official instructions says to run terraform -install-complete and this command updates my ~/.bashrc. This obviously doesn’t work:

$ terraform -install-autocomplete
Error executing CLI: 1 error occurred:
        * open /home/h/.bashrc: permission denied

I’m wondering: does anyone managed to get completions working for Terraform on NixOs?

1 Like

GitHub issue to request an enhanced for Terraform: [cli] Emit shell completions to stdout · Issue #32611 · hashicorp/terraform · GitHub