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). 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.35.0
  terradart_cloudflare: ^0.35.0

Usage example

// lib/edge_dns_stack.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(
      'main',
      name: .literal('example.com'),
      account: ZoneAccount(id: .literal('your-account-id')),
    );
    add(zone);
    add(
      CloudflareDnsRecord(
        'api',
        zoneId: zone.ref,
        name: .literal('api.example.com'),
        type: .cname,
        ttl: .literal(1),
        content: .content(.literal('ghs.googlehosted.com')),
        proxied: .literal(true),
      ),
    );
  }
}
// bin/infra.dart
import 'package:my_app/edge_dns_stack.dart';

Future<void> main() async {
  final stack = EdgeDnsStack();
  await stack.writeTo('tf-out');
}
dart pub get
dart pub global activate terradart_cli
CLOUDFLARE_API_TOKEN=... terradart apply

Curated surface

Curated surface is the full cloudflare/cloudflare catalog at the pin — every resource and data source — across per-service barrels (zone, dns, r2, zero_trust, workers, …). The provider is pinned exactly (kCloudflareProviderVersionConstraint, the release the wrappers were generated from). Start with examples/cloudflare_dns_quickstart; the rest of the catalog is exercised by examples/cloudflare_leftover_quickstart (synth only; CI validates it against the provider).

Generated by the maintainer pipeline (terradart-codegen 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.
ct
Cloudflare Certificate Transparency alerting.
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.
field
Cloudflare account-level field extractors.
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.
nel
Cloudflare Network Error Logging (NEL) zone setting.
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).
precursor
Cloudflare Precursor zone enforcement modes and rules.
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).