Difference between revisions of "Terraform destroy"

From wikieduonline
Jump to navigation Jump to search
 
(39 intermediate revisions by 3 users not shown)
Line 1: Line 1:
* https://www.terraform.io/docs/cli/commands/destroy.html
+
{{lowercase}}
 +
<code>terraform destroy</code> destroy all remote objects managed by a particular Terraform configuration.
  
<pre>
+
https://www.terraform.io/docs/cli/commands/destroy.html
terraform destroy
 
aws_instance.app_server: Refreshing state... [id=i-0598bc37b772faaa3]
 
  
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
+
== Examples ==
following symbols:
+
* <code>terraform destroy</code>
  - destroy
+
* <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>
  
Terraform will perform the following actions:
+
== Executions examples ==
 +
* [[Example execution terraform destroy]]
 +
* [[Example execution terraform destroy aws_instance]]
  
  # aws_instance.app_server will be destroyed
+
== Related ==
  - resource "aws_instance" "app_server" {
+
* <code>[[terraform show]]</code>
      - ami                                  = "ami-830c94e3" -> null
+
* <code>[[terraform apply]]</code>
      - arn                                  = "arn:aws:ec2:us-west-2:72859226533:instance/i-0598bc37b772faaa3" -> null
+
* <code>[[terraform apply -destroy]]</code>
      - associate_public_ip_address          = true -> null
+
* <code>[[terraform state rm]]</code>
      - availability_zone                    = "us-west-2a" -> null
+
* <code>[[Still destroying...]]</code>
      - cpu_core_count                      = 1 -> null
+
* [[Destroy complete! Resources: 39 destroyed.]]
      - cpu_threads_per_core                = 1 -> null
+
* [[Acquiring state lock. This may take a few moments...]]
.../...
 
  
Plan: 0 to add, 0 to change, 1 to destroy.
+
== Errors ==
 +
* <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.]]
  
Do you really want to destroy all resources?
+
==Related terms==
  Terraform will destroy all your managed infrastructure, as shown above.
+
* [[Example execution terraform destroy aws instance]]
  There is no undo. Only 'yes' will be accepted to confirm.
+
* [[Editing Error: 0m Error: ERROR cluster with name not found]]
  
  Enter a value: yes
+
== Activities ==
 
+
* [[How to destroy all resources except one?]]
aws_instance.app_server: Destroying... [id=i-0598bc37b772faaa3]
 
aws_instance.app_server: Still destroying... [id=i-0598bc37b772faaa3, 10s elapsed]
 
aws_instance.app_server: Destruction complete after 30s
 
 
 
Destroy complete! Resources: 1 destroyed.
 
</pre>
 
 
 
 
 
 
 
 
 
 
 
[[terraform destroy --help]]
 
 
 
==See also ==
 
* {{terraform cmd}}
 
  
 +
== See also ==
 +
* {{terraform destroy}}
 +
* {{tf files}}
  
 
[[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: