# D1 database that stores links, sessions, users, and promotion submissions. resource "cloudflare_d1_database" "shortlinks" { account_id = var.account_id name = var.d1_database_name primary_location_hint = var.primary_location_hint } # Workers KV namespace used as a public link cache in front of D1. resource "cloudflare_workers_kv_namespace" "public_cache" { account_id = var.account_id title = var.kv_namespace_title } # Custom domain for the public shortlinks host (heygo.cc / dev.heygo.cc). # Verified v5 resource name: cloudflare_workers_custom_domain # (see https://developers.cloudflare.com/api/terraform/resources/workers/subresources/domains/). resource "cloudflare_workers_custom_domain" "public" { account_id = var.account_id zone_id = var.heygo_cc_zone_id hostname = var.public_domain service = var.worker_name } # Custom domain for the private shortlinks host (my.heygo.cc / my.dev.heygo.cc). resource "cloudflare_workers_custom_domain" "private" { account_id = var.account_id zone_id = var.private_domain_zone_id hostname = var.private_domain service = var.worker_name }