# Resources

### Overview

Resources are the primary building blocks in Terraform. They represent infrastructure objects that Terraform creates and manages. The TeraSwitch provider includes resources for compute infrastructure.

### Available Resources

| Resource                                              | Description        |
| ----------------------------------------------------- | ------------------ |
| [teraswitch\_metal](/integrations/terraform/metal.md) | Bare metal servers |

### Common Patterns

#### Resource Dependencies

Use `depends_on` to explicitly define dependencies between resources:

```hcl
resource "teraswitch_metal" "database" {
  hostname = "db-01"
  region   = "PIT1"
  # ... configuration
}

resource "teraswitch_metal" "web" {
  hostname   = "web-01"
  region     = "PIT1"
  # ... configuration

  depends_on = [teraswitch_metal.database]
}
```

#### Lifecycle Management

Control resource behavior with lifecycle blocks:

```hcl
resource "teraswitch_metal" "database" {
  hostname = "db-01"
  region   = "PIT1"
  # ... configuration

  lifecycle {
    prevent_destroy = true  # Prevent accidental deletion
  }
}
```

#### Tagging Resources

Apply consistent tags for organization and cost tracking:

```hcl
locals {
  common_tags = {
    environment = "production"
    team        = "platform"
    managed_by  = "terraform"
  }
}

resource "teraswitch_metal" "app" {
  hostname = "app-01"
  region   = "PIT1"
  tags     = local.common_tags
}
```

### Resource Timeouts

Some resources have configurable timeouts for long-running operations:

```hcl
resource "teraswitch_metal" "database" {
  # ... configuration

  timeouts {
    create = "45m"  # Metal provisioning can take time
    delete = "15m"
  }
}
```


---

# 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://docs.teraswitch.com/integrations/terraform/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.
