terradart_cloudflare

pub: terradart_cloudflare Dart SDK License: Apache-2.0

Curated factory wrappers for Cloudflare resources (the official cloudflare/cloudflare Terraform provider) for Dart-first Terraform stacks.

Cloudflare's positioning in a Dart stack is the infrastructure edge around your app — DNS zones and records that point custom domains toward Cloud Run, Firebase Hosting, or wherever your Dart backend lives. (This package does not deploy Dart on Workers; it declares the Cloudflare edge infrastructure your Dart app sits behind.)

The catalog at the current provider pin is filled (every cloudflare_* resource and data source in 5.23.0). Nested plugin-framework objects are typed Dart helper classes, not TfArg<Map<String, dynamic>>. A later pin that adds names lands on request — open a feature request.

Security & Credentials

Secrets never appear in synth output by design. CloudflareProvider has no api_token / api_key / api_user_service_key parameters (sensitive attributes are structurally excluded); authenticate at apply time via CLOUDFLARE_API_TOKEN (recommended) or other standard CLOUDFLARE_* environment variables.

Installation

dependencies:
  terradart_core: ^0.28.x
  terradart_cloudflare: ^0.28.x

Usage example

import 'package:terradart_core/terradart_core.dart';
import 'package:terradart_cloudflare/provider.dart';
import 'package:terradart_cloudflare/zone.dart';
import 'package:terradart_cloudflare/dns.dart';

final class EdgeDnsStack extends Stack {
  EdgeDnsStack()
      : super(providers: [const CloudflareProvider()]) {
    final zone = CloudflareZone(
      localName: 'main',
      name: TfArg.literal('example.com'),
      account: ZoneAccount(id: TfArg.literal('your-account-id')),
    );
    add(zone);
    add(
      CloudflareDnsRecord(
        localName: 'api',
        zoneId: TfArg.ref(zone.id),
        name: TfArg.literal('api.example.com'),
        type: TfArg.literal('CNAME'),
        ttl: TfArg.literal(1),
        content: TfArg.literal('ghs.googlehosted.com'),
        proxied: TfArg.literal(true),
      ),
    );
  }
}
// bin/infra.dart
import 'package:my_infra/edge_dns_stack.dart';

Future<void> main() async {
  final stack = EdgeDnsStack();
  await stack.writeTo('tf-out');
}
dart pub get
dart run bin/infra.dart
cd tf-out && terraform init && CLOUDFLARE_API_TOKEN=... terraform apply

Curated surface

Curated surface is the full cloudflare/cloudflare 5.23.0 catalog: 257 resource factories + 446 data sources (703 catalog entries) across per-service barrels (zone, dns, r2, zero_trust, workers, …). Provider pinned exactly at 5.23.0. Start with examples/cloudflare_dns_quickstart; the rest of the catalog is exercised by examples/cloudflare_leftover_quickstart (synth + terraform validate only).

Generated by the maintainer pipeline (terradart wrap against the pin fixture); do not hand-edit files under lib/src/.

Libraries

access
Cloudflare zone IP access rules (not Zero Trust Access).
account
Cloudflare accounts, members, tokens, and organization settings.
address_map
Cloudflare address maps (BYOIP advertising).
ai
Cloudflare AI Gateway and AI Search.
api_shield
Cloudflare API Shield, schema validation, and token validation.
argo
Cloudflare Argo Smart Routing and Tiered Caching.
byo_ip
Bring-your-own IP prefixes.
cache
Cloudflare cache reserves, variants, and tiered cache.
calls
Cloudflare Calls (SFU / TURN apps).
catalog
Static catalog of all curated terradart_cloudflare factories.
cloud_connector
Cloudflare Cloud Connector rules.
cloudforce_one
Cloudforce One requests and assets.
connectivity
Cloudflare Connectivity Directory services.
custom_hostname
Cloudflare for SaaS custom hostnames.
d1
Cloudflare D1 databases.
data
Read-only Cloudflare data sources (no terraform apply side effects).
dls
Cloudflare DLS prefix bindings.
dns
Cloudflare DNS records, firewall, and zone transfers.
email
Cloudflare Email Routing and Email Security.
flagship
Cloudflare Flagship apps and flags.
google_tag
Google Tag Gateway for Cloudflare.
healthcheck
Cloudflare standalone health checks.
hyperdrive
Cloudflare Hyperdrive configs.
image
Cloudflare Images and variants.
load_balancer
Cloudflare Load Balancing pools, monitors, and balancers.
logs
Cloudflare Logpush jobs and Logpull retention.
magic
Cloudflare Magic WAN, Magic Transit, and Magic Network Monitoring.
moq
Cloudflare Media over QUIC relays.
notifications
Cloudflare notification policies and webhooks.
observatory
Cloudflare Observatory scheduled tests.
origin
Cloudflare origin cloud regions and related origin settings.
pages
Cloudflare Pages projects and domains.
pipeline
Cloudflare Pipelines (streams and sinks).
provider
Provider block factory and version constants for cloudflare/cloudflare.
queues
Cloudflare Queues and consumers.
r2
Cloudflare R2 buckets, custom domains, and lifecycle.
regional
Cloudflare regional hostnames.
registrar
Cloudflare Registrar domains.
rules
Cloudflare rulesets, page rules, lists, and filters.
secrets
Cloudflare Secrets Store.
security
Cloudflare WAF, bot management, firewall, and related security.
share
Cloudflare resource shares.
snippet
Cloudflare Snippets and snippet rules.
spectrum
Cloudflare Spectrum applications.
ssl
Cloudflare SSL/TLS certificates, packs, and origin pull.
stream
Cloudflare Stream videos, live inputs, and watermarks.
terradart_cloudflare
Curated Cloudflare surface for TerraDart (official cloudflare/cloudflare Terraform provider).
transforms
Cloudflare managed transforms.
turnstile
Cloudflare Turnstile widgets.
user
Cloudflare user account and groups.
waiting_room
Cloudflare Waiting Room.
web3
Cloudflare Web3 hostnames.
web_analytics
Cloudflare Web Analytics sites and rules.
workers
Cloudflare Workers scripts, routes, KV, and Workers for Platforms.
workflow
Cloudflare Workflows.
zero_trust
Cloudflare Zero Trust Access, Gateway, DLP, DEX, and tunnels.
zone
Cloudflare zones (domains under Cloudflare management).