Skip to main content
Manages a Kosli logical environment. Logical environments aggregate multiple physical environments for organizational purposes.
Logical environments can ONLY contain physical environments (K8S, ECS, S3, docker, server, lambda), not other logical environments. Attempting to include a logical environment will result in an error from the Kosli API.
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.
Logical environments in Kosli aggregate multiple physical environments for organizational purposes, providing:
  • Unified visibility: View compliance status across multiple environments at once
  • Flexible grouping: Organize environments by region, service type, tier, or team
  • Simplified reporting: Generate compliance reports for logical groupings
  • Team organization: Allow different teams to focus on specific environment groups

Physical environments only

Logical environments can ONLY contain physical environments (K8S, ECS, S3, docker, server, lambda), not other logical environments. Attempting to include a logical environment will result in an API error.

Example usage

Complete example

For a comprehensive example showing logical environments aggregating physical environments by region, service type, and tier, see the complete logical environments example.

Common use cases

By environment tier

Aggregate all production or staging environments for unified compliance reporting:

By geographic region

Group environments by region for regional compliance or disaster recovery:

By service type

Organize environments by technology stack or service type:

Empty logical environments

Logical environments can be created with empty included_environments lists and populated later:

Import

Logical environments can be imported using their name:

Querying metadata

Schema

Required

  • included_environments (List of String) List of physical environment names to aggregate. Only physical environments are allowed (K8S, ECS, S3, docker, server, lambda). Can be empty.
  • name (String) Name of the logical environment. Must be unique within the organization. Changing this will force recreation of the resource.

Optional

  • description (String) Description of the logical environment. Explains the purpose and aggregation strategy.
  • 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.

Read-only

  • type (String) Type of the environment. Always set to logical (computed by provider, not user-configurable).
Last modified on April 15, 2026