Why use tags
- Organize resources — group related resources by team, project, region, or any other dimension.
- Drive policy behavior — reference tags in Environment Policy expressions to make attestation requirements conditional. For example, require security scans only for flows tagged
risk-level=high. - Add operational metadata — store context such as cost center, service tier, or owner directly on the resource.
Supported resources
You can tag the following Kosli resource types:Tag key and value rules
- Keys must start with a letter or digit and can contain letters, digits, hyphens (
-), underscores (_), dots (.), and tildes (~). - Values are strings. If a value is a valid URL (e.g.
https://example.com), Kosli automatically renders it as a clickable link in the UI. - There is no fixed limit on the number of tags per resource, but keep them concise for readability.
Add or update tags
- Terraform
- CLI
- API
Add a Tag a flow:Tag a repo with a
tags map to any kosli_environment, kosli_flow, or kosli_control resource. Tags are applied via a diff — only changed tags are sent to the API.Tag an environment:kosli_repo_tags resource. Kosli records repos itself, so look up the repo’s internal ID with the kosli_repo or kosli_repos data source:kosli_repo_tags manages every tag on the repo, so Terraform removes tags added outside it, in the UI or with kosli tag repo, on the next apply.See the kosli_environment resource, kosli_flow resource and kosli_repo_tags resource for the full schema.Remove tags
- Terraform
- CLI
- API
Remove individual tags by deleting them from the For a repo, set
tags map. Set tags = {} to remove all tags:tags = {} on its kosli_repo_tags resource. Destroying a kosli_repo_tags resource also removes every tag on the repo.Read tags
- Terraform
- CLI
- API
Use data sources to read tags from existing resources:The
kosli_repo data source returns a repo’s tags the same way. The kosli_repos data source returns tags on each entry of its repos list.Recommended tag patterns
A consistent tagging strategy makes it easier to organize resources as your Kosli usage grows. Here are common patterns:Example: categorizing environments by stage
Tag your environments to reflect their deployment stage. This lets you quickly identify which environments are production-critical and apply policies accordingly:- Terraform
- CLI
Using tags in policies
Tags become powerful when combined with Environment Policies. You can reference flow tags in policy expressions to conditionally require attestations:security-scan attestation is only required when the flow is tagged with risk-level=high. This lets you enforce stricter compliance for high-risk services while keeping lighter requirements for lower-risk ones.
For the full expression syntax, see the Environment Policy reference.