Skip to content

terraform -install-autocomplete does not respect ZDOTDIR for zsh #38342

@tkuhemiya

Description

@tkuhemiya

Terraform Version

Terraform v1.14.8
on darwin_arm64

Terraform Configuration Files

Debug Output

➜  basics git:(main) TF_LOG=trace terraform -install-autocomplete
2026-04-03T23:34:03.659+0530 [INFO]  Terraform version: 1.14.8
2026-04-03T23:34:03.659+0530 [DEBUG] using github.com/hashicorp/go-tfe v1.94.0
2026-04-03T23:34:03.659+0530 [DEBUG] using github.com/hashicorp/hcl/v2 v2.24.0
2026-04-03T23:34:03.659+0530 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2026-04-03T23:34:03.659+0530 [DEBUG] using github.com/zclconf/go-cty v1.16.3
2026-04-03T23:34:03.659+0530 [INFO]  Go runtime version: go1.25.8
2026-04-03T23:34:03.659+0530 [INFO]  CLI args: []string{"terraform", "-install-autocomplete"}
2026-04-03T23:34:03.659+0530 [TRACE] Stdout is a terminal of width 155
2026-04-03T23:34:03.659+0530 [TRACE] Stderr is a terminal of width 155
2026-04-03T23:34:03.659+0530 [TRACE] Stdin is a terminal
2026-04-03T23:34:03.659+0530 [DEBUG] Attempting to open CLI config file: /Users/themiya/.terraformrc
2026-04-03T23:34:03.659+0530 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2026-04-03T23:34:03.659+0530 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2026-04-03T23:34:03.659+0530 [DEBUG] ignoring non-existing provider search directory /Users/themiya/.terraform.d/plugins
2026-04-03T23:34:03.659+0530 [DEBUG] ignoring non-existing provider search directory /Users/themiya/Library/Application Support/io.terraform/plugins
2026-04-03T23:34:03.659+0530 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2026-04-03T23:34:03.660+0530 [INFO]  CLI command args: []string{"-install-autocomplete"}
Error executing CLI: Did not find any shells to install

Expected Behavior

Terraform should detect zsh as the active shell and locate the
initialization file using $ZDOTDIR when it is set, falling back to
~/.zshrc otherwise.

Actual Behavior

Terraform reports "Did not find any shells to install" unless the ~/.zshrc file is present.

Steps to Reproduce

  1. Set export ZDOTDIR="$HOME/.config/zsh" in environment
  2. Place zsh config in $ZDOTDIR/.zshrc
  3. Run terraform -install-autocomplete
  4. Observe error: "Did not find any shells to install"

Additional Context

Environment:

  • SHELL=/bin/zsh
  • ZDOTDIR=$HOME/.config/zsh
  • zsh version: zsh 5.9 (arm64-apple-darwin25.0)

References

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions