Skip to content

Cloudflare.Addressing reference

Source: packages/cloudflare/src/Addressing/AddressMap.ts

A Cloudflare Address Map — assigns account-owned or Cloudflare-assigned static IPs to zones (BYOIP / Enterprise static IPs).

Requires the BYOIP add-on or Cloudflare-assigned static IPs on the account; without the entitlement every mutating call fails with the typed FeatureNotEnabled error (address_maps_not_enabled_on_account).

Disabled map with a description

const map = yield* Cloudflare.Addressing.AddressMap("static-ips", {
description: "static ingress IPs",
enabled: false,
});

Map with IPs and zone memberships

const map = yield* Cloudflare.Addressing.AddressMap("ingress", {
description: "ingress",
enabled: true,
ips: ["192.0.2.1"],
memberships: [{ identifier: zone.zoneId, kind: "zone" }],
});
const map = yield* Cloudflare.Addressing.AddressMap("legacy", {
enabled: true,
defaultSni: "example.com",
});

Source: packages/cloudflare/src/Addressing/BgpPrefix.ts

A BGP prefix controlling on-demand advertisement of a BYOIP prefix (or a subnet of it) to the internet.

Cloudflare automatically creates BGP prefixes during BYOIP onboarding, so reconcile adopts an existing BGP prefix matching the CIDR before creating a new one. There is no delete API — destroying this resource only withdraws the advertisement (advertised: false) and drops the state.

Advertise the whole BYOIP prefix

const bgp = yield* Cloudflare.Addressing.BgpPrefix("advertise", {
prefixId: prefix.prefixId,
cidr: prefix.cidr,
advertised: true,
});

Withdraw with AS-Path prepending configured

const bgp = yield* Cloudflare.Addressing.BgpPrefix("advertise", {
prefixId: prefix.prefixId,
cidr: prefix.cidr,
advertised: false,
asnPrependCount: 2,
});

Source: packages/cloudflare/src/Addressing/Prefix.ts

A BYOIP (Bring Your Own IP) prefix onboarded to Cloudflare’s network.

Requires the BYOIP enterprise add-on; onboarding a prefix is a contract process (LOA, IRR/RPKI validation, manual approval) — approved flips from "P" (pending) to "V" (active) on Cloudflare’s side and is never waited on by this resource.

Only description is mutable; cidr, asn, and the LOA settings force a replacement.

Onboard a prefix with a pre-uploaded LOA

const prefix = yield* Cloudflare.Addressing.Prefix("byoip", {
cidr: "192.0.2.0/24",
asn: 64496,
description: "production ingress",
loaDocumentId: loa.id,
});

Delegate LOA creation to Cloudflare

const prefix = yield* Cloudflare.Addressing.Prefix("byoip", {
cidr: "192.0.2.0/24",
asn: 64496,
delegateLoaCreation: true,
});
const bgp = yield* Cloudflare.Addressing.BgpPrefix("advertise", {
prefixId: prefix.prefixId,
cidr: prefix.cidr,
advertised: true,
});

Prefixes are usually onboarded once, by contract. Prefix.lookup references one Alchemy doesn’t manage (onboarded in the dashboard or by another stack), found by prefixId or cidr. It is read during plan/deploy and never created, updated or deleted.

const prefix = Cloudflare.Addressing.Prefix.lookup({ cidr: "203.0.113.0/24" });
yield* Cloudflare.Addressing.BgpPrefix("advertise", {
prefixId: prefix.prefixId,
cidr: prefix.cidr,
advertised: true,
});

Source: packages/cloudflare/src/Addressing/PrefixDelegation.ts

Delegates part of a BYOIP prefix to another Cloudflare account, allowing that account to use the delegated CIDR (e.g. for its own service bindings).

Delegations are create/delete only — every prop change forces a replacement.

const delegation = yield* Cloudflare.Addressing.PrefixDelegation("share", {
prefixId: prefix.prefixId,
cidr: "192.0.2.0/26",
delegatedAccountId: "023e105f4ecef8ad9ca31a8372d0c353",
});

Source: packages/cloudflare/src/Addressing/ServiceBinding.ts

Binds part of a BYOIP prefix to a Cloudflare service (CDN, Spectrum, or Magic Transit), routing traffic for the bound CIDR to that service.

Bindings are create/delete only — every prop change forces a replacement. Provisioning to the edge is asynchronous: the binding is returned immediately with provisioning.state: "provisioning" and flips to "active" on Cloudflare’s side; the resource does not wait for it.

ServiceBinding: Binding a Prefix to a Service

Section titled “ServiceBinding: Binding a Prefix to a Service”
const binding = yield* Cloudflare.Addressing.ServiceBinding("cdn", {
prefixId: prefix.prefixId,
cidr: "192.0.2.0/24",
serviceId: cdnServiceId,
});