# Connectors - Terraform Resources

import DocButton from '~/components/webkit/DocButton.vue';

<DocButton href="https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/connector" label="View in Terraform Registry" kind="secondary" size="medium" />

Connectors replace the concept of origins in API v4. They provide a flexible way to configure origins for your applications.

---

The `azion_connector` resource allows you to manage origin connectors through Terraform. Connectors define how your applications communicate with content origins.

### Available Resources

| Resource | Description |
|---------|-------------|
| [`azion_connector`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/connector) | Creates and manages connectors |

### Available Data Sources

| Data Source | Description |
|--------------|-------------|
| [`azion_connectors`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/connectors) | Query existing connectors |

---

## azion_connector

### Basic Example

```hcl
resource "azion_connector" "example" {
  name = "my-connector"
  
  # Connector configuration
}
```

### Main Arguments

| Argument | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Unique connector name |

For the complete list of arguments, see the [Terraform Registry](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/connector).

### Exported Attributes

| Attribute | Type | Description |
|----------|------|-------------|
| `id` | string | Unique connector ID |

---

## Complete Example

```hcl
terraform {
  required_providers {
    azion = {
      source  = "aziontech/azion"
      version = "2.0.0"
    }
  }
}

provider "azion" {
  api_token = var.api_token
}

# Create a connector
resource "azion_connector" "my_origin" {
  name = "my-origin"
  
  # Origin configuration
}

# Query existing connectors
data "azion_connectors" "all" {}

output "connector_id" {
  value = azion_connector.my_origin.id
}
```

---

## Migrating from Origins (V3 to V4)

If you're migrating from API v3, the `azion_application_origin` resource has been replaced by `azion_connector`.

### Before (V3)

```hcl
resource "azion_application_origin" "example" {
  application_id = azion_application_main_setting.example.id
  name                = "my-origin"
  origin_type         = "single_origin"
  origin_address      = "origin.example.com"
  origin_protocol     = "https"
}
```

### After (V4)

```hcl
resource "azion_connector" "example" {
  name = "my-connector"
  
  # Connector configuration
}
```

See the [Migration Guide](/en/documentation/products/terraform-provider/terraform-migration-v3-to-v4/) for more details.

---

## Next Steps

- [Workloads](/en/documentation/products/terraform-provider/resources/workloads/) - Manage workloads
- [Applications](/en/documentation/products/terraform-provider/resources/applications/) - Manage applications