# 3. Delete Resources

* If we want to destroy the instance that we created, we can use the command `terraform destroy`
* Keep in mind that by default it destroys all the resources specified in the config file
* To delete a single resource, specific flags must be passed to the command
* In the previous example, if we want to delete the ec2 instance without using `terraform destroy` command, then, we will comment out the ec2 resource and re apply the config. Terraform will figure it out and delete the ec2 instance for us

```hcl
#####################
# Modifying EC2 Instance Tag
#####################
#resource "aws_instance" "my-first-server" {
#    ami = "ami-052efd3df9dad4825"
#    instance_type = "t2.micro"
#
#    tags = {
#        Name = "ubuntu"
#    }
#}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.nomanaziz.me/devops/infrastructure-as-a-code-iac/terraform/3.-delete-resources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
