Skip to content

ShareResource

Source: src/Cloudflare/ResourceSharing/ShareResource.ts

A resource entry on an existing Cloudflare share — adds a shareable resource (gateway policy, custom ruleset, …) to a Share incrementally.

Only meta is mutable in place; changing the share, type, id, or owning account triggers a replacement. A share must always retain at least one resource — the last entry cannot be deleted (delete the Share instead). Do not manage the same entry both inline on Share.resources and through this resource.

const entry = yield* Cloudflare.ShareResource("ExtraPolicy", {
shareId: share.shareId,
resourceType: "gateway-policy",
resourceId: policy.ruleId,
});
const entry = yield* Cloudflare.ShareResource("ExtraPolicy", {
shareId: share.shareId,
resourceType: "gateway-policy",
resourceId: policy.ruleId,
meta: { note: "rotated" },
});