Each needs to define an autocomplete script.
oh-my-zsh provides plugins that do that for common tools like git.
Those scripts are usually supplied by the CLI tool itself. For example for terraform: https://www.terraform.io/docs/cli/commands/index.html#shell-...