Skip to main content
Fetches details of an existing Kosli logical environment. Use this data source to reference logical environments and access their aggregated physical environments. Use this data source to query existing logical environments in Kosli. This is useful for:
  • Referencing metadata: Access last_modified_at timestamps and other computed attributes
  • Cross-stack references: Reference logical environments created outside Terraform
  • Dynamic configuration: Use existing logical environment configurations to create variants
  • Validation: Verify logical environments exist before referencing them
  • Monitoring: Create conditional logic based on logical environment state

Example usage

Type validation

This data source validates that the queried environment is of type logical. Attempting to query a physical environment will result in an error. Use the kosli_environment data source for physical environments instead.

Use cases

Reference metadata

Query logical environment metadata for monitoring or conditional logic:

Create variants

Use an existing logical environment as a template for creating similar ones:

Cross-stack references

Reference logical environments created in other Terraform workspaces or outside Terraform:

Conditional logic

Create conditional logic based on logical environment configuration:

Schema

Required

  • name (String) The name of the logical environment to query.

Read-only

  • description (String) The description of the logical environment.
  • included_environments (List of String) List of physical environment names aggregated by this logical environment.
  • last_modified_at (Number) Unix timestamp (with fractional seconds) of when the logical environment was last modified.
  • tags (Map of String) Key-value pairs tagging the logical environment.
  • type (String) The environment type (always logical for logical environments).
Last modified on April 15, 2026