# Connectors resources

[View in Terraform Registry](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/connector)

A connector sets how your applications communicate with the origins that hold your content. In API v4, connectors take the place of the origins of API v3. The Azion Terraform Provider manages [Connectors](/en/documentation/platform/connectors/) with one resource and reads them with two data sources. In provider v1.x, an origin resource that belonged to an application did this work. To move a v1.x configuration to connectors, refer to [Migrate from provider v1.x to v2.0](/en/documentation/devtools/terraform/terraform-migration-v3-to-v4/).

---

## Connector resources

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

`azion_connector` requires `name`, a string that holds the unique name of the connector, and exports `id`, a string that holds the unique ID of the connector. The Terraform Registry page of the resource lists every argument.

---

## Data sources

| Data source                                                                                                       | Description          |
| ----------------------------------------------------------------------------------------------------------------- | -------------------- |
| [`azion_connectors`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/connectors) | Lists connectors.    |
| [`azion_connector`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/connector)   | Reads one connector. |

---

## Example

This configuration pins the provider, creates a connector, reads the existing connectors, and outputs the ID of the connector. It reads your personal token from the `api_token` variable that the [Azion Terraform Provider quickstart](/en/documentation/devtools/terraform/getting-started/) declares.

```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
}
```

---

## Related resources

- [Connectors](/en/documentation/platform/connectors.md): The platform page for connectors and the settings of each request to an origin.
- [Resources and data sources](/en/documentation/devtools/terraform/examples.md): Every resource and data source of the provider, with an example per family.
- [Workloads resources](/en/documentation/devtools/terraform/workloads.md): The resources that manage workloads and their deployments.
- [Applications resources](/en/documentation/devtools/terraform/applications.md): The resources that manage applications, their cache settings, rules, device groups, and function instances.
