Why use tags
- Organize resources — group related flows or environments 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:| Resource type | Terraform resource | CLI identifier |
|---|---|---|
| Flow | kosli_flow | flow |
| Environment | kosli_environment | env |
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:See the
tags map to any kosli_environment or kosli_flow resource. Tags are applied via a diff — only changed tags are sent to the API.Tag an environment:kosli_environment resource and kosli_flow resource for the full schema.Remove tags
- Terraform
- CLI
- API
Remove individual tags by deleting them from the
tags map. Set tags = {} to remove all tags:Read tags
- Terraform
- API
Use data sources to read tags from existing resources:
Recommended tag patterns
A consistent tagging strategy makes it easier to organize resources as your Kosli usage grows. Here are common patterns:| Tag key | Example values | Purpose |
|---|---|---|
tier | dev, staging, prod | Distinguish environment stages |
team | platform, payments, mobile | Identify the owning team |
region | eu-west-1, us-east-1 | Track geographic location |
risk-level | high, medium, low | Drive conditional policy behavior |
cost-center | eng-1234, ops-5678 | Map to internal accounting |
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.