This repository contains a custom Terraform module for managing Cloudflare configurations. The module is designed for reusability, allowing you to manage DNS records, security settings, and other Cloudflare resources efficiently.
- DNS Record Management: Easily configure DNS records for your domains.
- Security Settings: Set up firewall rules and other security settings.
- Provider Configuration: Set up the Cloudflare provider for seamless integration with your account.
- Variables Support: Customize the module behavior using input variables.
Before using this module, ensure you have the following:
- Terraform 0.12+ installed.
- A Cloudflare account with API access enabled.
- Proper permissions to manage DNS and security settings for your domains.
module "cloudflare" {
source = "<path-to-your-module>"
# Define your input variables here
records = var.records
zone_id = var.zone_id
api_token = var.api_token
}variable "records" {
description = "Array of DNS records"
type = list(object({
name = string
type = string
value = string
ttl = number
proxied = bool
}))
}
variable "zone_id" {
description = "The Cloudflare zone ID for the domain"
type = string
}
variable "api_token" {
description = "API Token for Cloudflare access"
type = string
}Make sure you configure the Cloudflare provider properly in your provider.tf file:
provider "cloudflare" {
api_token = var.api_token
}provider "cloudflare" {
api_token = "your-api-token-here" # Replace with your Cloudflare API token
}- Outputs can be defined in the
outputs.tffile.
This module is maintained by Masoud Ehteshami.
This project is licensed under the MIT License - see the LICENSE file for details.