Merge pull request #17527 from ryosan-470/fix-old-completion-config
Remove old completion file for zsh
This commit is contained in:
commit
d345732b3c
|
@ -1,5 +1,11 @@
|
|||
# Terraform zsh completion
|
||||
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
## Install
|
||||
```console
|
||||
% terraform -install-autocomplete
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
```console
|
||||
% terraform -uninstall-autocomplete
|
||||
```
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
#compdef terraform
|
||||
|
||||
local -a _terraform_cmds
|
||||
_terraform_cmds=(
|
||||
'apply:Builds or changes infrastructure'
|
||||
'destroy:Destroy Terraform-managed infrastructure'
|
||||
'get:Download and install modules for the configuration'
|
||||
'graph:Create a visual graph of Terraform resources'
|
||||
'init:Initializes Terraform configuration from a module'
|
||||
'output:Read an output from a state file'
|
||||
'plan:Generate and show an execution plan'
|
||||
'pull:Refreshes the local state copy from the remote server'
|
||||
'push:Uploads the local state to the remote server'
|
||||
'refresh:Update local state file against real resources'
|
||||
'remote:Configures remote state management'
|
||||
'taint:Manually forcing a destroy and recreate on the next plan/apply'
|
||||
'show:Inspect Terraform state or plan'
|
||||
'version:Prints the Terraform version'
|
||||
)
|
||||
|
||||
__apply() {
|
||||
_arguments \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
|
||||
'-input=[(true) Ask for input for variables if not directly set.]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
|
||||
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
|
||||
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
|
||||
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
|
||||
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
|
||||
}
|
||||
|
||||
__destroy() {
|
||||
_arguments \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
|
||||
'-force[Do not ask for input for destroy confirmation.]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
|
||||
'-state=[Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
|
||||
'-state-out=[Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
|
||||
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
|
||||
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
|
||||
}
|
||||
|
||||
__get() {
|
||||
_arguments \
|
||||
'-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]'
|
||||
}
|
||||
|
||||
__graph() {
|
||||
_arguments \
|
||||
'-module-depth=[(n) The maximum depth to expand modules. By default this is -1, which will expand all modules.]'
|
||||
}
|
||||
|
||||
__init() {
|
||||
_arguments \
|
||||
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
|
||||
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
|
||||
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
|
||||
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
|
||||
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]'
|
||||
}
|
||||
|
||||
__output() {
|
||||
_arguments \
|
||||
'-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]'
|
||||
}
|
||||
|
||||
__plan() {
|
||||
_arguments \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with" .backup" extension. Set to "-" to disable backup.]' \
|
||||
'-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
|
||||
'-input=[(true) Ask for input for variables if not directly set.]' \
|
||||
'-module-depth=[(n) Specifies the depth of modules to show in the output. This does not affect the plan itself, only the output shown. By default, this is -1, which will expand all.]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
|
||||
'-refresh=[(true) Update state prior to checking for differences.]' \
|
||||
'-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]' \
|
||||
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
|
||||
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
|
||||
}
|
||||
|
||||
__push() {
|
||||
_arguments \
|
||||
'-force[Forces the upload of the local state, ignoring any conflicts. This should be used carefully, as force pushing can cause remote state information to be lost.]'
|
||||
}
|
||||
|
||||
__refresh() {
|
||||
_arguments \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
|
||||
'-input=[(true) Ask for input for variables if not directly set.]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
|
||||
'-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
|
||||
'-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
|
||||
'-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]'
|
||||
}
|
||||
|
||||
__taint() {
|
||||
_arguments \
|
||||
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
|
||||
'-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
|
||||
'-no-color[If specified, output will not contain any color.]' \
|
||||
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
|
||||
'-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
|
||||
}
|
||||
|
||||
__remote() {
|
||||
_arguments \
|
||||
'-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
|
||||
'-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
|
||||
'-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
|
||||
'-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]' \
|
||||
'-disable[Disables remote state management and migrates the state to the -state path.]' \
|
||||
'-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
|
||||
'-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \
|
||||
'-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \
|
||||
'-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]'
|
||||
}
|
||||
|
||||
__show() {
|
||||
_arguments \
|
||||
'-module-depth=[(n) The maximum depth to expand modules. By default this is -1, which will expand all modules.]' \
|
||||
'-no-color[If specified, output will not contain any color.]'
|
||||
}
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "terraform command" _terraform_cmds
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
apply)
|
||||
__apply ;;
|
||||
destroy)
|
||||
__destroy ;;
|
||||
get)
|
||||
__get ;;
|
||||
graph)
|
||||
__graph ;;
|
||||
init)
|
||||
__init ;;
|
||||
output)
|
||||
__output ;;
|
||||
plan)
|
||||
__plan ;;
|
||||
push)
|
||||
__push ;;
|
||||
refresh)
|
||||
__refresh ;;
|
||||
remote)
|
||||
__remote ;;
|
||||
show)
|
||||
__show ;;
|
||||
taint)
|
||||
__taint ;;
|
||||
esac
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
ZSH_FUNC_DIR="/usr/share/zsh/site-functions"
|
||||
|
||||
if [ -d "$ZSH_FUNC_DIR" ]; then
|
||||
echo "Installing into ${ZSH_FUNC_DIR}..."
|
||||
sudo cp ./_terraform "$ZSH_FUNC_DIR"
|
||||
echo "Installed! Make sure that ${ZSH_FUNC_DIR} is in your \$fpath."
|
||||
else
|
||||
echo "Could not find ${ZSH_FUNC_DIR}. Please install manually."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue