Editing Terraform destroy

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{lowercase}}
+
* https://www.terraform.io/docs/cli/commands/destroy.html
<code>terraform destroy</code> destroy all remote objects managed by a particular Terraform configuration.
 
  
https://www.terraform.io/docs/cli/commands/destroy.html
+
<pre>
 +
terraform destroy
 +
aws_instance.app_server: Refreshing state... [id=i-0598bc37b772faaa3]
  
== Examples ==
+
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
* <code>terraform destroy</code>
+
following symbols:
* <code>[[terraform destroy -auto-approve]]</code>
+
  - destroy
* <code>terraform destroy [[-target]]=your_resource</code>
 
* <code>terraform destroy [[-var-fil]]e="your_file.tfvars"</code>
 
* <code>[[terraform destroy --help]]</code>
 
  
== Executions examples ==
+
Terraform will perform the following actions:
* [[Example execution terraform destroy]]
 
* [[Example execution terraform destroy aws_instance]]
 
  
== Related ==
+
  # aws_instance.app_server will be destroyed
* <code>[[terraform show]]</code>
+
  - resource "aws_instance" "app_server" {
* <code>[[terraform apply]]</code>
+
      - ami                                  = "ami-830c94e3" -> null
* <code>[[terraform apply -destroy]]</code>
+
      - arn                                  = "arn:aws:ec2:us-west-2:72859226533:instance/i-0598bc37b772faaa3" -> null
* <code>[[terraform state rm]]</code>
+
      - associate_public_ip_address          = true -> null
* <code>[[Still destroying...]]</code>
+
      - availability_zone                    = "us-west-2a" -> null
* [[Destroy complete! Resources: 39 destroyed.]]
+
      - cpu_core_count                      = 1 -> null
* [[Acquiring state lock. This may take a few moments...]]
+
      - cpu_threads_per_core                = 1 -> null
 +
.../...
  
== Errors ==
+
Plan: 0 to add, 0 to change, 1 to destroy.
* <code>[[DependencyViolation]]: .../... has dependencies and cannot be deleted.</code>
 
* <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.]]
 
  
==Related terms==
+
Do you really want to destroy all resources?
* [[Example execution terraform destroy aws instance]]
+
  Terraform will destroy all your managed infrastructure, as shown above.
* [[Editing Error: 0m Error: ERROR cluster with name not found]]
+
  There is no undo. Only 'yes' will be accepted to confirm.
  
== Activities ==
+
  Enter a value: yes
* [[How to destroy all resources except one?]]
 
  
== See also ==
+
aws_instance.app_server: Destroying... [id=i-0598bc37b772faaa3]
* {{terraform destroy}}
+
aws_instance.app_server: Still destroying... [id=i-0598bc37b772faaa3, 10s elapsed]
* {{tf files}}
+
aws_instance.app_server: Destruction complete after 30s
 +
 
 +
Destroy complete! Resources: 1 destroyed.
 +
</pre>
 +
 
 +
 
 +
 
 +
 
 +
<pre>
 +
terraform destroy --help
 +
Usage: terraform destroy [options] [DIR]
 +
 
 +
  Destroy Terraform-managed infrastructure.
 +
 
 +
Options:
 +
 
 +
  -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.
 +
 
 +
  -auto-approve          Skip interactive approval before destroying.
 +
 
 +
  -force                Deprecated: same as auto-approve.
 +
 
 +
  -lock=true            Lock the state file when locking is supported.
 +
 
 +
  -lock-timeout=0s      Duration to retry a state lock.
 +
 
 +
  -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 cmd}}
 +
* {{terraform}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Advertising: