Difference between revisions of "Terraform destroy"

From wikieduonline
Jump to navigation Jump to search
(Created page with " <pre> terraform destroy --help Usage: terraform destroy [options] [DIR] Destroy Terraform-managed infrastructure. Options: -backup=path Path to backup the e...")
 
 
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{lowercase}}
 +
<code>terraform destroy</code> destroy all remote objects managed by a particular Terraform configuration.
  
 +
https://www.terraform.io/docs/cli/commands/destroy.html
  
<pre>
+
== Examples ==
terraform destroy --help
+
* <code>terraform destroy</code>
Usage: terraform destroy [options] [DIR]
+
* <code>[[terraform destroy -auto-approve]]</code>
 +
* <code>terraform destroy [[-target]]=your_resource</code>
 +
* <code>terraform destroy [[-var-fil]]e="your_file.tfvars"</code>
 +
* <code>[[terraform destroy --help]]</code>
  
  Destroy Terraform-managed infrastructure.
+
== Executions examples ==
 +
* [[Example execution terraform destroy]]
 +
* [[Example execution terraform destroy aws_instance]]
  
Options:
+
== Related ==
 +
* <code>[[terraform show]]</code>
 +
* <code>[[terraform apply]]</code>
 +
* <code>[[terraform apply -destroy]]</code>
 +
* <code>[[terraform state rm]]</code>
 +
* <code>[[Still destroying...]]</code>
 +
* [[Destroy complete! Resources: 39 destroyed.]]
 +
* [[Acquiring state lock. This may take a few moments...]]
  
  -backup=path          Path to backup the existing state file before
+
== Errors ==
                        modifying. Defaults to the "-state-out" path with
+
* <code>[[DependencyViolation]]: .../... has dependencies and cannot be deleted.</code>
                        ".backup" extension. Set to "-" to disable backup.
+
* <code>[[Error: deleting EBS Volume]]</code>
 +
* [[AWS Error: failed to refresh cached credentials]]
 +
* [[AWS Error: A Profile was specified along with the environment variables "AWS ACCESS KEY ID" and "AWS SECRET ACCESS KEY". The Profile is now used instead of the environment variable credentials.]]
  
  -auto-approve          Skip interactive approval before destroying.
+
==Related terms==
 +
* [[Example execution terraform destroy aws instance]]
 +
* [[Editing Error: 0m Error: ERROR cluster with name not found]]
  
  -force                Deprecated: same as auto-approve.
+
== Activities ==
 +
* [[How to destroy all resources except one?]]
  
  -lock=true            Lock the state file when locking is supported.
+
== See also ==
 
+
* {{terraform destroy}}
  -lock-timeout=0s      Duration to retry a state lock.
+
* {{tf files}}
 
 
  -no-color              If specified, output won't contain any color.
 
 
 
  -parallelism=n        Limit the number of concurrent operations.
 
                        Defaults to 10.
 
 
 
  -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.
 
 
 
  -target=resource      Resource to target. Operation will be limited to this
 
                        resource and its dependencies. This flag can be used
 
                        multiple times.
 
 
 
  -var 'foo=bar'        Set a variable in the Terraform configuration. This
 
                        flag can be set multiple times.
 
 
 
  -var-file=foo          Set variables in the Terraform configuration from
 
                        a file. If "terraform.tfvars" or any ".auto.tfvars"
 
                        files are present, they will be automatically loaded.
 
</pre>
 
 
 
 
 
==See also ==
 
* {{terraform}}
 
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 23:20, 11 February 2024

terraform destroy destroy all remote objects managed by a particular Terraform configuration.

https://www.terraform.io/docs/cli/commands/destroy.html

Examples[edit]

Executions examples[edit]

Related[edit]

Errors[edit]

Related terms[edit]

Activities[edit]

See also[edit]

Advertising: