Skip to content

Share

Source: src/Cloudflare/ResourceSharing/Share.ts

A Cloudflare resource share — shares account-level configuration (gateway policies, custom rulesets, IdP federation grants, …) with another account or organization.

The create API requires at least one recipient and one resource, so both are seeded inline. Post-create changes to those arrays are reconciled through the recipient/resource sub-APIs; only name is mutable on the share itself. Deletion is asynchronous (active → deleting → deleted).

const policy = yield* Cloudflare.GatewayRule("BlockPhishing", {
action: "block",
traffic: 'dns.fqdn == "phishing.example"',
filters: ["dns"],
});
const share = yield* Cloudflare.Share("PolicyShare", {
recipients: [{ accountId: "<recipient-account-id>" }],
resources: [
{ resourceType: "gateway-policy", resourceId: policy.ruleId },
],
});
const share = yield* Cloudflare.Share("PolicyShare", {
name: "security-baseline-v2",
recipients: [{ accountId: "<recipient-account-id>" }],
resources: [
{ resourceType: "gateway-policy", resourceId: policy.ruleId },
],
});