Cloudflare.Tags reference
AccountResourceTags
Section titled “AccountResourceTags”Source:
src/Cloudflare/Tags/AccountResourceTags.ts
Key/value tags attached to an account-level Cloudflare resource via the unified resource-tagging API (open beta).
The tag SET is the resource: PUT replaces the full set, and deleting
this resource clears every tag from the target. Cloudflare reports an
untagged (or unknown) resource as an empty tag set rather than a 404, so
an empty set is treated as “absent”.
Safety: tags carry no ownership markers. On a cold read (no prior state)
a non-empty tag set on the target resource is reported as Unowned, and
the engine refuses to take it over (i.e. clobber the existing tags)
unless --adopt or adopt(true) is set.
AccountResourceTags: Tagging a resource
Section titled “AccountResourceTags: Tagging a resource”Tag a KV namespace
const kv = yield* Cloudflare.KV.Namespace("cache", {});
yield* Cloudflare.Tags.AccountResourceTags("cache-tags", { resourceType: "kv_namespace", resourceId: kv.namespaceId, tags: { team: "platform", env: "production" },});Tag the account itself
yield* Cloudflare.Tags.AccountResourceTags("account-tags", { resourceType: "account", resourceId: accountId, tags: { "cost-center": "eng-42" },});ZoneResourceTags
Section titled “ZoneResourceTags”Source:
src/Cloudflare/Tags/ZoneResourceTags.ts
Key/value tags attached to a zone-level Cloudflare resource via the unified resource-tagging API (open beta).
The tag SET is the resource: PUT replaces the full set, and deleting
this resource clears every tag from the target. Cloudflare reports an
untagged (or unknown) resource as an empty tag set rather than a 404, so
an empty set is treated as “absent”.
Safety: tags carry no ownership markers. On a cold read (no prior state)
a non-empty tag set on the target resource is reported as Unowned, and
the engine refuses to take it over (i.e. clobber the existing tags)
unless --adopt or adopt(true) is set.
ZoneResourceTags: Tagging a resource
Section titled “ZoneResourceTags: Tagging a resource”Tag a DNS record
const record = yield* Cloudflare.DNS.Record("api", { zoneId: zone.zoneId, name: "api.example.com", type: "A", content: "203.0.113.42",});
yield* Cloudflare.Tags.ZoneResourceTags("api-tags", { zoneId: zone.zoneId, resourceType: "dns_record", resourceId: record.recordId, tags: { team: "platform", env: "production" },});Tag the zone itself
yield* Cloudflare.Tags.ZoneResourceTags("zone-tags", { zoneId: zone.zoneId, resourceType: "zone", resourceId: zone.zoneId, tags: { "cost-center": "eng-42" },});