Difference between revisions of "Terraform destroy"

From wikieduonline
Jump to navigation Jump to search
Line 39: Line 39:
  
  
<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>
 
  
 +
[[terraform destroy --help]]
  
 
==See also ==
 
==See also ==

Revision as of 09:57, 24 August 2021

 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
following symbols:
  - destroy

Terraform will perform the following actions:

  # aws_instance.app_server will be destroyed
  - resource "aws_instance" "app_server" {
      - ami                                  = "ami-830c94e3" -> null
      - arn                                  = "arn:aws:ec2:us-west-2:72859226533:instance/i-0598bc37b772faaa3" -> null
      - associate_public_ip_address          = true -> null
      - availability_zone                    = "us-west-2a" -> null
      - cpu_core_count                       = 1 -> null
      - cpu_threads_per_core                 = 1 -> null
.../...

Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

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.



terraform destroy --help

See also

Advertising: