Skip to content

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.

Tag a KV namespace

const kv = yield* Cloudflare.KVNamespace("cache", {});
yield* Cloudflare.AccountResourceTags("cache-tags", {
resourceType: "kv_namespace",
resourceId: kv.namespaceId,
tags: { team: "platform", env: "production" },
});

Tag the account itself

yield* Cloudflare.AccountResourceTags("account-tags", {
resourceType: "account",
resourceId: accountId,
tags: { "cost-center": "eng-42" },
});