Pulumi Cloudflare Provider

raw JSON →
6.14.0 verified Mon Apr 27 auth: no python

A Pulumi package for managing Cloudflare resources. Currently at v6.14.0, requires Python >=3.9. Release cadence is irregular, roughly monthly.

pip install pulumi-cloudflare
error ImportError: cannot import name 'Record' from 'cloudflare'
cause Mistaking the official Cloudflare SDK for the Pulumi provider.
fix
Use 'from pulumi_cloudflare import Record' instead.
error KeyError: 'zone_id'
cause Trying to access a property that doesn't exist on the resource yet (e.g., before applying).
fix
Ensure you use pulumi.Output and apply() correctly, e.g., record.zone_id.apply(lambda zid: ...)
error pulumi.errors.ResourceConflictError: resource 'example-zone' already exists
cause Trying to create a zone with a name that already exists in your Cloudflare account.
fix
Use pulumi.import or change the resource name and zone attribute.
breaking v6.11.0 introduced 36 breaking changes including required fields and missing outputs. Upgrade with caution.
fix Review the changelog and adjust your Pulumi code accordingly.
breaking v6.10.0 introduced 92 breaking changes including property removals and input requirement changes.
fix Check your usage of affected resources like AddressMap, EmailRoutingDns, TeamsRule, ZeroTrustDexTest.
gotcha Do not install the official 'cloudflare' SDK and try to use its classes in Pulumi resources. They are separate packages.
fix Use pulumi_cloudflare for infrastructure, and cloudflare for API access only.
deprecated Some resources like 'cloudflare:index/apiShield:ApiShield' have had outputs removed in recent versions.
fix Check resource documentation for any removed properties.

Create a Cloudflare zone and an A record.

import pulumi
import pulumi_cloudflare as cloudflare

zone = cloudflare.Zone(
    "example-zone",
    zone="example.com",
    plan="free",
    account_id=os.environ.get('CLOUDFLARE_ACCOUNT_ID', '')
)

record = cloudflare.Record(
    "example-record",
    zone_id=zone.id,
    name="www",
    type="A",
    value="1.2.3.4",
    ttl=120,
)

pulumi.export("zone_name", zone.zone)