This Terraform module provisions and manages DNS records in Cloudflare zones.
Before using this Terraform module, ensure you have the following:
- Cloudflare Account & Zone IDs, see documentation.
- A Domain name managed with Cloudflare.
- A Cloudflare API token with zone permissions to manage records, set as value of environment variable
CLOUDFLARE_API_TOKEN.
This module is meant for use with Terraform 1.6+.
module "cloudflare_dns" {
source = "[email protected]:enomy/terraform/terraform-cloudflare-dns.git"
zone_id = var.cloudflare_zone_id
dns_records = [
{
name = "shops"
type = "CNAME"
content = "api.enomy.cloud"
ttl = 30
}
]
}Perform the following commands on the project folder:
terraform initto get the pluginsterraform planto see the infrastructure planterraform applyto apply the infrastructure buildterraform destroyto destroy the built infrastructure
The project has the following folders and files:
main.tf> Contains all resources and business logic to create them.variables.tf> Variables needed to provision de module.version.tf> Minimum required terraform version.