97a86ed1678022683d9f0113ada51f4ed8aa7375

Author
Maxime Brunet <max@brnt.mx>
Committer
GitHub <noreply@github.com>
Date

Message

feat(terraform): update completion to `v1.7` (#12252)

Diff

This diff is truncated to protect this page.

 1diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
 2index 6258345635a22bb069efbfaae610608aa8580c1d..aad1c6096e37690819e3df515a9424c00891c16d 100644
 3--- a/plugins/terraform/_terraform
 4+++ b/plugins/terraform/_terraform
 5@@ -1,411 +1,529 @@
 6 #compdef terraform
 7-
 8-local -a _terraform_cmds opt_args
 9-_terraform_cmds=(
10-    'apply:Builds or changes infrastructure'
11-    'console:Interactive console for Terraform interpolations'
12-    'destroy:Destroy Terraform-managed infrastructure'
13-    'fmt:Rewrites config files to canonical format'
14-    'force-unlock:Manually unlock the terraform state'
15-    'get:Download and install modules for the configuration'
16-    'graph:Create a visual graph of Terraform resources'
17-    'import:Import existing infrastructure into Terraform'
18-    'init:Initialize a Terraform working directory'
19+compdef _terraform terraform
20+
21+(( ${+functions[_terraform_commands]} )) || _terraform_commands() {
22+  local -a _terraform_cmds
23+  _terraform_cmds=(
24+    'apply:Create or update infrastructure'
25+    'console:Try Terraform expressions at an interactive command prompt'
26+    'destroy:Destroy previously-created infrastructure'
27+    'fmt:Reformat your configuration in the standard style'
28+    'force-unlock:Release a stuck lock on the current workspace'
29+    'get:Install or upgrade remote Terraform modules'
30+    'graph:Generate a Graphviz graph of the steps in an operation'
31+    'import:Associate existing infrastructure with a Terraform resource'
32+    'init:Prepare your working directory for other commands'
33     'login:Obtain and save credentials for a remote host'
34     'logout:Remove locally-stored credentials for a remote host'
35-    'output:Read an output from a state file'
36-    'plan:Generate and show an execution plan'
37-    'providers:Prints a tree of the providers used in the configuration'
38-    'refresh:Update local state file against real resources'
39-    'show:Inspect Terraform state or plan'
40+    'metadata:Metadata related commands'
41+    'output:Show output values from your root module'
42+    'plan:Show changes required by the current configuration'
43+    'providers:Show the providers required for this configuration'
44+    'refresh:Update the state to match remote systems'
45+    'show:Show the current state or a saved plan'
46     'state:Advanced state management'
47-    'taint:Manually mark a resource for recreation'
48-    'untaint:Manually unmark a resource as tainted'
49-    'validate:Validates the Terraform files'
50-    'version:Prints the Terraform version'
51+    'taint:Mark a resource instance as not fully functional'
52+    'test:Execute integration tests for Terraform modules'
53+    'untaint:Remove the '\''tainted'\'' state from a resource instance'
54+    'validate:Check whether the configuration is valid'
55+    'version:Show the current Terraform version'
56     'workspace:Workspace management'
57-    '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
58-    '0.13upgrade:Rewrites pre-0.13 module source code for v0.13'
59-)
60+  )
61+  if ((CURRENT == 1)); then
62+    _describe -t commands 'terraform commands' _terraform_cmds
63+    return
64+  fi
65+
66+  local curcontext="${curcontext}"
67+  cmd="${${_terraform_cmds[(r)$words[1]:*]%%:*}}"
68+  curcontext="${curcontext%:*:*}:terraform-${cmd}:"
69+
70+  if (( ${+functions[_terraform_$cmd]} )); then
71+    "_terraform_${cmd}"
72+  else
73+    _message "no more options"
74+  fi
75+}
76 
77-__012upgrade() {
78+(( ${+functions[_terraform_apply]} )) || _terraform_apply() {
79+  _arguments \
80+    '-auto-approve[Skip interactive approval of plan before applying.]' \
81+    '-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.]:backupfile:_files -g "*.backup"' \
82+    '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
83+    '-destroy[Destroy Terraform-managed infrastructure. The command "terraform destroy" is a convenience alias for this option.]' \
84+    '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
85+    '-lock-timeout=[(0s) Duration to retry a state lock.]' \
86+    '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
87+    '-no-color[If specified, output won'\''t contain any color.]' \
88+    '-parallelism=[(10) Limit the number of parallel resource operations.]' \