7f3e6143ec03fd0b2558027783b375d42ceb3e4d

Author
gkze <george.kontridze@gmail.com>
Committer
gkze <george.kontridze@gmail.com>
Date

Message

Add terraform completion

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..3f357b18311014a6cac79fe4e5fffeeb015a13de
  4--- /dev/null
  5+++ b/plugins/terraform/README.md
  6@@ -0,0 +1,11 @@
  7+## atom
  8+
  9+Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently.
 10+
 11+### Requirements
 12+
 13+ * [Terraform](https://teraform.io/)
 14+
 15+### Usage
 16+
 17+ * Type `terraform` into your prompt and hit `TAB` to see available completion options
 18diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
 19new file mode 100644
 20index 0000000000000000000000000000000000000000..1252bb9619415c8d08cd36e53249061e55876dcd
 21--- /dev/null
 22+++ b/plugins/terraform/_terraform
 23@@ -0,0 +1,161 @@
 24+#compdef terraform
 25+
 26+local -a _terraform_cmds
 27+_terraform_cmds=(
 28+    'apply:Builds or changes infrastructure'
 29+    'destroy:Destroy Terraform-managed infrastructure'
 30+    'get:Download and install modules for the configuration'
 31+    'graph:Create a visual graph of Terraform resources'
 32+    'init:Initializes Terraform configuration from a module'
 33+    'output:Read an output from a state file'
 34+    'plan:Generate and show an execution plan'
 35+    'pull:Refreshes the local state copy from the remote server'
 36+    'push:Uploads the local state to the remote server'
 37+    'refresh:Update local state file against real resources'
 38+    'remote:Configures remote state management'
 39+    'taint:Manually forcing a destroy and recreate on the next plan/apply'
 40+    'show:Inspect Terraform state or plan'
 41+    'version:Prints the Terraform version'
 42+)
 43+
 44+__apply() {
 45+    _arguments \
 46+        '-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.]' \
 47+        '-input=[(true) Ask for input for variables if not directly set.]' \
 48+        '-no-color[If specified, output will not contain any color.]' \
 49+        '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
 50+        '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
 51+        '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
 52+        '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
 53+        '-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.]'
 54+}
 55+
 56+__destroy() {
 57+    _arguments \
 58+        '-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.]' \
 59+        '-force[Do not ask for input for destroy confirmation.]' \
 60+        '-no-color[If specified, output will not contain any color.]' \
 61+        '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
 62+        '-state=[Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
 63+        '-state-out=[Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
 64+        '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
 65+        '-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.]'
 66+}
 67+
 68+__get() {
 69+    _arguments \
 70+        '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]'
 71+}
 72+
 73+__graph() {
 74+    _arguments \
 75+        '-module-depth=[(n) The maximum depth to expand modules. By default this is zero, which will not expand modules at all.]'
 76+}
 77+
 78+__init() {
 79+    _arguments \
 80+        '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \
 81+        '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \
 82+        '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \
 83+        '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \
 84+        '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]'
 85+}
 86+
 87+__output() {
 88+    _arguments \
 89+        '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]'
 90+}
 91+
 92+__plan() {
 93+    _arguments \
 94+        '-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.]' \
 95+        '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
 96+        '-input=[(true) Ask for input for variables if not directly set.]' \
 97+        '-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.]' \
 98+        '-no-color[If specified, output will not contain any color.]' \
 99+        '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
100+        '-refresh=[(true) Update state prior to checking for differences.]' \
101+        '-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.]' \
102+        '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
103+        '-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.]'
104+}
105+
106+__push() {
107+    _arguments \
108+        '-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.]'
109+}
110+
111+__refresh() {
112+    _arguments \
113+        '-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.]' \
114+        '-input=[(true)  Ask for input for variables if not directly set.]' \
115+        '-no-color[If specified, output will not contain any color.]' \
116+        '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]' \
117+        '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]' \
118+        '-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
119+        '-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.]'
120+}
121+
122+__taint() {