github.com/spirius/terraform@v0.10.0-beta2.0.20170714185654-87b2c0cf8fea/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 local state to the remote server'
    14      'refresh:Update local state file against real resources'
    15      'remote:Configures remote state management'
    16      'taint:Manually forcing a destroy and recreate on the next plan/apply'
    17      'show:Inspect Terraform state or plan'
    18      'version:Prints the Terraform version'
    19  )
    20  
    21  __apply() {
    22      _arguments \
    23          '-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.]' \
    24          '-input=[(true) Ask for input for variables if not directly set.]' \
    25          '-no-color[If specified, output will not contain any color.]' \
    26          '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
    27          '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
    28          '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
    29          '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
    30          '-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.]'
    31  }
    32  
    33  __destroy() {
    34      _arguments \
    35          '-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.]' \
    36          '-force[Do not ask for input for destroy confirmation.]' \
    37          '-no-color[If specified, output will not contain any color.]' \
    38          '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
    39          '-state=[Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
    40          '-state-out=[Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
    41          '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
    42          '-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.]'
    43  }
    44  
    45  __get() {
    46      _arguments \
    47          '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]'
    48  }
    49  
    50  __graph() {
    51      _arguments \
    52          '-module-depth=[(n) The maximum depth to expand modules. By default this is -1, which will expand all modules.]'
    53  }
    54  
    55  __init() {
    56      _arguments \
    57          '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
    58          '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
    59          '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
    60          '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
    61          '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]'
    62  }
    63  
    64  __output() {
    65      _arguments \
    66          '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]'
    67  }
    68  
    69  __plan() {
    70      _arguments \
    71          '-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.]' \
    72          '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
    73          '-input=[(true) Ask for input for variables if not directly set.]' \
    74          '-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.]' \
    75          '-no-color[If specified, output will not contain any color.]' \
    76          '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
    77          '-refresh=[(true) Update state prior to checking for differences.]' \
    78          '-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.]' \
    79          '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
    80          '-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.]'
    81  }
    82  
    83  __push() {
    84      _arguments \
    85          '-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.]'
    86  }
    87  
    88  __refresh() {
    89      _arguments \
    90          '-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.]' \
    91          '-input=[(true)  Ask for input for variables if not directly set.]' \
    92          '-no-color[If specified, output will not contain any color.]' \
    93          '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
    94          '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
    95          '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
    96          '-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.]'
    97  }
    98  
    99  __taint() {
   100      _arguments \
   101          '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
   102          '-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.]' \
   103          '-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).]' \
   104          '-no-color[If specified, output will not contain any color.]' \
   105          '-state=[(path) Path to read and save state (unless state-out is  specified). Defaults to "terraform.tfstate".]' \
   106          '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]'
   107  }
   108  
   109  __remote() {
   110      _arguments \
   111          '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
   112          '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
   113          '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
   114          '-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.]' \
   115          '-disable[Disables remote state management and migrates the state to the -state path.]' \
   116          '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
   117          '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' \
   118          '-pull=[(true) Controls if the remote state is pulled before disabling. This defaults to true to ensure the latest state is cached before disabling.]' \
   119          '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]'
   120  }
   121  
   122  __show() {
   123      _arguments \
   124          '-module-depth=[(n) The maximum depth to expand modules. By default this is -1, which will expand all modules.]' \
   125          '-no-color[If specified, output will not contain any color.]'
   126  }
   127  
   128  _arguments '*:: :->command'
   129  
   130  if (( CURRENT == 1 )); then
   131    _describe -t commands "terraform command" _terraform_cmds
   132    return
   133  fi
   134  
   135  local -a _command_args
   136  case "$words[1]" in
   137    apply)
   138      __apply ;;
   139    destroy)
   140      __destroy ;;
   141    get)
   142      __get ;;
   143    graph)
   144      __graph ;;
   145    init)
   146      __init ;;
   147    output)
   148      __output ;;
   149    plan)
   150      __plan ;;
   151    push)
   152      __push ;;
   153    refresh)
   154      __refresh ;;
   155    remote)
   156      __remote ;;
   157    show)
   158      __show ;;
   159    taint)
   160      __taint ;;
   161  esac