# Edge DNS resources

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

The Azion Terraform Provider manages [Edge DNS](/en/documentation/platform/edge-dns/) with three resources and reads it with four data sources. A zone holds the records of a domain, and DNSSEC adds a layer of security to a zone. The identifiers keep the `intelligent_dns` form that the provider uses, and they have the same names in provider v1.x and v2.0. For more information, refer to [Migrate from provider v1.x to v2.0](/en/documentation/devtools/terraform/terraform-migration-v3-to-v4/).

---

## Edge DNS resources

| Resource                                                                                                                               | Description                            |
| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| [`azion_intelligent_dns_zone`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/intelligent_dns_zone)     | Creates and manages a DNS zone.        |
| [`azion_intelligent_dns_record`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/intelligent_dns_record) | Creates and manages a DNS record.      |
| [`azion_intelligent_dns_dnssec`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/resources/intelligent_dns_dnssec) | Manages the DNSSEC settings of a zone. |

`azion_intelligent_dns_zone` requires `name`, a string that holds the name of the zone, and takes the optional boolean `active`, which sets whether the zone is active. `azion_intelligent_dns_record` requires four strings: `zone_id`, the ID of the zone that holds the record; `name`, the name of the record; `type`, the record type, such as `A`, `AAAA`, or `CNAME`; and `value`, the value of the record. It also takes the optional number `ttl`, the time to live of the record in seconds. `azion_intelligent_dns_dnssec` takes `zone_id` and `active`. The record and DNSSEC resources read the zone ID from the `id` attribute of the zone resource. For every record type, refer to [Record types](/en/documentation/platform/edge-dns/record-types/). The Terraform Registry page of each resource lists every argument.

---

## Data sources

| Data source                                                                                                                                 | Description                          |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| [`azion_intelligent_dns_zones`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/intelligent_dns_zones)     | Lists DNS zones.                     |
| [`azion_intelligent_dns_zone`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/intelligent_dns_zone)       | Reads one DNS zone.                  |
| [`azion_intelligent_dns_records`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/intelligent_dns_records) | Lists DNS records.                   |
| [`azion_intelligent_dns_dnssec`](https://registry.terraform.io/providers/aziontech/azion/latest/docs/data-sources/intelligent_dns_dnssec)   | Reads the DNSSEC settings of a zone. |

---

## Example

This configuration pins the provider, creates a zone with an `A` record and a `CNAME` record, turns on DNSSEC for the zone, and outputs the zone ID. 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 DNS zone
resource "azion_intelligent_dns_zone" "my_zone" {
  name   = "example.com"
  active = true
}

# Create A record
resource "azion_intelligent_dns_record" "www" {
  zone_id = azion_intelligent_dns_zone.my_zone.id
  name    = "www"
  type    = "A"
  value   = "192.0.2.1"
  ttl     = 3600
}

# Create CNAME record
resource "azion_intelligent_dns_record" "alias" {
  zone_id = azion_intelligent_dns_zone.my_zone.id
  name    = "alias"
  type    = "CNAME"
  value   = "www.example.com"
  ttl     = 3600
}

# Enable DNSSEC
resource "azion_intelligent_dns_dnssec" "my_dnssec" {
  zone_id = azion_intelligent_dns_zone.my_zone.id
  active  = true
}

output "zone_id" {
  value = azion_intelligent_dns_zone.my_zone.id
}
```

---

## Related resources

- [Resources and data sources](/en/documentation/devtools/terraform/examples.md): Every resource and data source of the provider, with an example per family.
- [Security resources](/en/documentation/devtools/terraform/security.md): The resources that manage firewalls, WAF settings, and network lists.
- [Certificates resources](/en/documentation/devtools/terraform/certificates.md): The resources that manage digital certificates.
- [Applications resources](/en/documentation/devtools/terraform/applications.md): The resources that manage applications and their settings.
