Skip to content

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.

Tag a DNS record

const record = yield* Cloudflare.DnsRecord("api", {
zoneId: zone.zoneId,
name: "api.example.com",
type: "A",
content: "203.0.113.42",
});
yield* Cloudflare.ZoneResourceTags("api-tags", {
zoneId: zone.zoneId,
resourceType: "dns_record",
resourceId: record.recordId,
tags: { team: "platform", env: "production" },
});

Tag the zone itself

yield* Cloudflare.ZoneResourceTags("zone-tags", {
zoneId: zone.zoneId,
resourceType: "zone",
resourceId: zone.zoneId,
tags: { "cost-center": "eng-42" },
});