Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.87 KB

File metadata and controls

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

A subdomain 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. It is only available for Enterprise accounts

NOTE: subdomain setup is only available for Enterprise accounts

Prerequisites

Create the zone

Create a cloudflare_zone resource for the subdomain zone. The following example creates a zone for subdomain.example.com:

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

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