github.com/jgadling/terraform@v0.3.8-0.20150227214559-abd68c2c87bc/contrib/zsh-completion/_terraform (about) 1 #compdef terraform 2 3 local -a _terraform_cmds 4 _terraform_cmds=( 5 'apply:Builds or changes infrastructure' 6 'destroy:Destroy Terraform-managed infrastructure' 7 'get:Download and install modules for the configuration' 8 'graph:Create a visual graph of Terraform resources' 9 'init:Initializes Terraform configuration from a module' 10 'output:Read an output from a state file' 11 'plan:Generate and show an execution plan' 12 'pull:Refreshes the local state copy from the remote server' 13 'push:Uploads the the local state to the remote server' 14 'refresh:Update local state file against real resources' 15 'remote:Configures remote state management' 16 'show:Inspect Terraform state or plan' 17 'version:Prints the Terraform version' 18 ) 19 20 __apply() { 21 _arguments \ 22 '-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.]' \ 23 '-input=[(true) Ask for input for variables if not directly set.]' \ 24 '-no-color[If specified, output will not contain any color.]' \ 25 '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ 26 '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ 27 '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ 28 '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ 29 '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' 30 } 31 32 __destroy() { 33 _arguments \ 34 '-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.]' \ 35 '-force[Do not ask for input for destroy confirmation.]' \ 36 '-no-color[If specified, output will not contain any color.]' \ 37 '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \ 38 '-state=[Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ 39 '-state-out=[Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ 40 '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ 41 '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' 42 } 43 44 __get() { 45 _arguments \ 46 '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' 47 } 48 49 __graph() { 50 _arguments \ 51 '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' 52 } 53 54 __init() { 55 _arguments \ 56 '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ 57 '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ 58 '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ 59 '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ 60 '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' 61 } 62 63 __output() { 64 _arguments \ 65 '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]' 66 } 67 68 __plan() { 69 _arguments \ 70 '-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.]' \ 71 '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \ 72 '-input=[(true) Ask for input for variables if not directly set.]' \ 73 '-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 zero. -1 will expand all.]' \ 74 '-no-color[If specified, output will not contain any color.]' \ 75 '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \ 76 '-refresh=[(true) Update state prior to checking for differences.]' \ 77 '-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.]' \ 78 '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ 79 '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' 80 } 81 82 __push() { 83 _arguments \ 84 '-force[Forces the upload of the local state, ignoring any conflits. This should be used carefully, as force pushing can cause remote state information to be lost.]' 85 } 86 87 __refresh() { 88 _arguments \ 89 '-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.]' \ 90 '-input=[(true) Ask for input for variables if not directly set.]' \ 91 '-no-color[If specified, output will not contain any color.]' \ 92 '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \ 93 '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \ 94 '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \ 95 '-var-file=[(path) Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified.]' 96 } 97 98 __remote() { 99 _arguments \ 100 '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ 101 '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ 102 '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ 103 '-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.]' \ 104 '-disable[Disables remote state management and migrates the state to the -state path.]' \ 105 '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ 106 '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \ 107 '-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]'\ 108 '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' 109 } 110 111 __show() { 112 _arguments \ 113 '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]' \ 114 '-no-color[If specified, output will not contain any color.]' 115 } 116 117 _arguments '*:: :->command' 118 119 if (( CURRENT == 1 )); then 120 _describe -t commands "terraform command" _terraform_cmds 121 return 122 fi 123 124 local -a _command_args 125 case "$words[1]" in 126 apply) 127 __apply ;; 128 destroy) 129 __destroy ;; 130 get) 131 __get ;; 132 graph) 133 __graph ;; 134 init) 135 __init ;; 136 output) 137 __output ;; 138 plan) 139 __plan ;; 140 push) 141 __push ;; 142 refresh) 143 __refresh ;; 144 remote) 145 __remote ;; 146 show) 147 __show ;; 148 esac