Skip to content

Commit a636ced

Browse files
docs: add tags attribute to Terraform reference pages for v0.6.0 (#151)
## Summary Updates Terraform reference docs to match the v0.6.0 release of `kosli-dev/terraform-provider-kosli`, which adds a `tags` attribute (Map of String) to environments, logical environments, and flows. ### Changes - **`kosli_environment` resource** — added `tags` optional attribute to schema, added tagged example, removed outdated warnings about tags not being supported - **`kosli_logical_environment` resource** — added `tags` optional attribute to schema, added tagged example, removed duplicate warning - **`kosli_flow` resource** — added `tags` optional attribute to schema, added tagged example - **`kosli_environment` data source** — added `tags` read-only attribute to schema, added tag output examples - **`kosli_logical_environment` data source** — added `tags` read-only attribute to schema, added tag output example - **`kosli_flow` data source** — added `tags` read-only attribute to schema, added tag output example No new resources or data sources were added in v0.6.0. Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
1 parent f13c1ee commit a636ced

6 files changed

Lines changed: 70 additions & 10 deletions

File tree

‎terraform-reference/data-sources/environment.mdx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ output "production_includes_scaling" {
5757
value = data.kosli_environment.production.include_scaling
5858
}
5959
60+
# Access tags applied to the environment
61+
output "production_tags" {
62+
description = "Tags applied to the production environment"
63+
value = data.kosli_environment.production.tags
64+
}
65+
66+
# Check if a specific tag exists
67+
output "production_managed_by" {
68+
description = "Who manages the production environment (from tags)"
69+
value = try(data.kosli_environment.production.tags["managed-by"], "unknown")
70+
}
71+
6072
# Conditional logic based on environment metadata
6173
locals {
6274
# Check if environment has never reported a snapshot
@@ -99,4 +111,5 @@ Data sources provide read-only access to environment metadata. To modify environ
99111
- `include_scaling` (Boolean) Whether the environment includes scaling events in snapshots.
100112
- `last_modified_at` (Number) Unix timestamp (with fractional seconds) of when the environment was last modified.
101113
- `last_reported_at` (Number) Unix timestamp (with fractional seconds) of when the environment was last reported. May be null if never reported.
114+
- `tags` (Map of String) Key-value pairs tagging the environment.
102115
- `type` (String) The environment type (e.g., K8S, ECS, S3, docker, server, lambda).

‎terraform-reference/data-sources/flow.mdx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ output "flow_template" {
3838
description = "The YAML template of the flow"
3939
value = data.kosli_flow.example.template
4040
}
41+
42+
output "flow_tags" {
43+
description = "The tags of the flow"
44+
value = data.kosli_flow.example.tags
45+
}
4146
```
4247

4348
## Schema
@@ -49,4 +54,5 @@ output "flow_template" {
4954
### Read-only
5055

5156
- `description` (String) The description of the flow.
57+
- `tags` (Map of String) Key-value pairs tagging the flow.
5258
- `template` (String) YAML template defining the flow structure (trails, artifacts, attestations).

‎terraform-reference/data-sources/logical_environment.mdx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ output "production_last_modified" {
6363
value = data.kosli_logical_environment.production.last_modified_at
6464
}
6565
66+
output "production_tags" {
67+
description = "Tags on the production logical environment"
68+
value = data.kosli_logical_environment.production.tags
69+
}
70+
6671
# Count how many environments are aggregated
6772
output "production_environment_count" {
6873
description = "Number of environments aggregated in production"
@@ -183,4 +188,5 @@ locals {
183188
- `description` (String) The description of the logical environment.
184189
- `included_environments` (List of String) List of physical environment names aggregated by this logical environment.
185190
- `last_modified_at` (Number) Unix timestamp (with fractional seconds) of when the logical environment was last modified.
191+
- `tags` (Map of String) Key-value pairs tagging the logical environment.
186192
- `type` (String) The environment type (always `logical` for logical environments).

‎terraform-reference/resources/environment.mdx‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ icon: "cube"
77
Manages a Kosli environment. Environments represent deployment targets where artifacts are deployed. Supports physical environment types: K8S, ECS, S3, docker, server, and lambda.
88

99
<Warning>
10-
This resource manages the environment configuration only. Environment tags are managed through a separate Kosli API. To attach compliance policies, use the [`kosli_policy_attachment` resource](/terraform-reference/resources/policy_attachment). For querying environment metadata such as `last_modified_at`, `last_reported_at`, and `archived` status, use the [`kosli_environment` data source](/terraform-reference/data-sources/environment).
10+
This resource manages the environment configuration and tags. To attach compliance policies, use the [`kosli_policy_attachment` resource](/terraform-reference/resources/policy_attachment). For querying environment metadata such as `last_modified_at`, `last_reported_at`, and `archived` status, use the [`kosli_environment` data source](/terraform-reference/data-sources/environment).
1111
</Warning>
1212

1313
Kosli environments track deployments and provide visibility into what's running in your infrastructure. Physical environments represent actual runtime locations such as:
@@ -23,10 +23,6 @@ Kosli environments track deployments and provide visibility into what's running
2323
For aggregating multiple physical environments into logical groups, use the [`kosli_logical_environment` resource](/terraform-reference/resources/logical_environment).
2424
</Note>
2525

26-
<Warning>
27-
Environment tags are managed through a separate Kosli API and are not included in this Terraform resource.
28-
</Warning>
29-
3026
<Note>
3127
To attach compliance policies to environments, use the [`kosli_policy_attachment` resource](/terraform-reference/resources/policy_attachment).
3228
</Note>
@@ -49,6 +45,18 @@ resource "kosli_environment" "production_k8s" {
4945
description = "Production Kubernetes cluster"
5046
}
5147
48+
# K8S environment with tags
49+
resource "kosli_environment" "tagged" {
50+
name = "production-k8s-tagged"
51+
type = "K8S"
52+
description = "Production cluster managed by Terraform"
53+
tags = {
54+
managed-by = "terraform"
55+
environment = "production"
56+
team = "platform"
57+
}
58+
}
59+
5260
# ECS environment with scaling
5361
resource "kosli_environment" "staging_ecs" {
5462
name = "staging-ecs"
@@ -133,3 +141,4 @@ For querying environment metadata such as `last_modified_at` and `last_reported_
133141

134142
- `description` (String) Description of the environment. Explains the purpose and characteristics of this deployment target.
135143
- `include_scaling` (Boolean) Whether to include scaling information when reporting environment snapshots. Defaults to `false`.
144+
- `tags` (Map of String) Key-value pairs to tag the environment. Tags are applied via a diff — only changed tags are sent to the API. An empty map (`tags = {}`) removes all tags.

‎terraform-reference/resources/flow.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ resource "kosli_flow" "with_description" {
3232
description = "CD pipeline for the API service"
3333
}
3434
35+
# Flow with tags
36+
resource "kosli_flow" "tagged" {
37+
name = "api-service-tagged"
38+
description = "API service CD pipeline managed by Terraform"
39+
tags = {
40+
managed-by = "terraform"
41+
team = "platform"
42+
environment = "production"
43+
}
44+
}
45+
3546
# Flow with a YAML template defining trails and attestations
3647
# The template can also be loaded from a file: template = file("template.yml")
3748
resource "kosli_flow" "with_template" {
@@ -74,4 +85,5 @@ terraform import kosli_flow.example my-flow-name
7485
### Optional
7586

7687
- `description` (String) Description of the flow. Explains the purpose and context of this pipeline.
88+
- `tags` (Map of String) Key-value pairs to tag the flow. Tags are applied via a diff — only changed tags are sent to the API. An empty map (`tags = {}`) removes all tags.
7789
- `template` (String) YAML template defining the flow structure (trails, artifacts, attestations). Can be provided as an inline heredoc or loaded from a file using `file()`. If omitted, the flow is created without a template.

‎terraform-reference/resources/logical_environment.mdx‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Logical environments can ONLY contain physical environments (K8S, ECS, S3, docke
1111
</Warning>
1212

1313
<Warning>
14-
This resource manages logical environment configuration only. For querying environment metadata such as `last_modified_at` and `archived` status, use the [`kosli_logical_environment` data source](/terraform-reference/data-sources/logical_environment).
14+
This resource manages logical environment configuration and tags. For querying environment metadata such as `last_modified_at` and `archived` status, use the [`kosli_logical_environment` data source](/terraform-reference/data-sources/logical_environment).
1515
</Warning>
1616

1717
Logical environments in Kosli aggregate multiple physical environments for organizational purposes, providing:
@@ -86,6 +86,23 @@ resource "kosli_logical_environment" "future_environments" {
8686
included_environments = []
8787
}
8888
89+
# Logical environment with tags
90+
resource "kosli_logical_environment" "tagged" {
91+
name = "production-tagged"
92+
description = "Tagged production logical environment"
93+
94+
included_environments = [
95+
kosli_environment.production_k8s.name,
96+
kosli_environment.production_ecs.name,
97+
]
98+
99+
tags = {
100+
managed-by = "terraform"
101+
environment = "production"
102+
team = "platform"
103+
}
104+
}
105+
89106
# Logical environment without description (optional)
90107
resource "kosli_logical_environment" "simple" {
91108
name = "simple-aggregate"
@@ -181,10 +198,6 @@ terraform import kosli_logical_environment.future_environments future-environmen
181198

182199
## Querying metadata
183200

184-
<Warning>
185-
This resource manages logical environment configuration only. For querying environment metadata such as `last_modified_at` and `archived` status, use the [`kosli_logical_environment` data source](/terraform-reference/data-sources/logical_environment).
186-
</Warning>
187-
188201
## Schema
189202

190203
### Required
@@ -195,6 +208,7 @@ This resource manages logical environment configuration only. For querying envir
195208
### Optional
196209

197210
- `description` (String) Description of the logical environment. Explains the purpose and aggregation strategy.
211+
- `tags` (Map of String) Key-value pairs to tag the logical environment. Tags are applied via a diff — only changed tags are sent to the API. An empty map (`tags = {}`) removes all tags.
198212

199213
### Read-only
200214

0 commit comments

Comments
 (0)