Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.78 KB

File metadata and controls

43 lines (33 loc) · 1.78 KB
pcx_content_type title sidebar head
how-to
Create a secondary zone using Terraform
order label
2
Create a secondary zone
tag content
title
Create a secondary zone using Terraform

A secondary zone lets you manage a subdomain in a separate Cloudflare zone from the parent domain. This is useful for access control and team management. This guide shows how to automate the setup using the Cloudflare Terraform provider.

Prerequisites

Create the zone

Create a cloudflare_zone resource with type = "secondary". The following example creates a secondary zone for subdomain.example.com:

resource "cloudflare_zone" "subdomain_example_com" {
  account = {
    id = var.cloudflare_account_id
  }
  name = "subdomain.example.com"
  type = "secondary"
}

Terraform creates the zone in a Pending state. You must add NS delegation records to the parent zone before Cloudflare activates it.

:::note Refer to the cloudflare_zone docs in the Terraform provider documentation when you need to reference other zone properties. :::

Related resources