1
0
IaC/terraform/cloudflare/main.tf

42 lines
937 B
Terraform
Raw Normal View History

2024-10-23 00:22:32 -04:00
# terraform file to create dns resource in cloudflare
terraform {
required_version = ">= 1.8.0"
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.44"
}
}
backend "local" {
path = "/home/michael/Nextcloud/Backups/tfstate/cloudflare.tfstate"
}
}
provider "cloudflare" {
api_token = var.api_token
}
data "cloudflare_accounts" "default" {
name = var.account_name
}
resource "cloudflare_zone" "balsillie_net" {
account_id = data.cloudflare_accounts.default[0].id
zone = "balsillie.net"
paused = false
plan = "free"
type = "full"
}
resource "cloudflare_dns_zone_dnssec" "balsillie_net" {
zone_id = cloudflare_zone.balsillie_net.id
}
resource "cloudflare_dns_record" "example_record" {
zone_id = cloudflare_zone.balsillie_net.id
proxied = false
type = "A"
ttl = 60
name = "@"
content = "5.161.254.39"
}