Skip to main content
Manages a Kosli environment. Environments represent deployment targets where artifacts are deployed. Supports physical environment types: K8S, ECS, S3, docker, server, and lambda.
This resource manages the environment configuration and tags. To attach compliance policies, use the kosli_policy_attachment resource. For querying environment metadata such as last_modified_at, last_reported_at, and archived status, use the kosli_environment data source.
Kosli environments track deployments and provide visibility into what’s running in your infrastructure. Physical environments represent actual runtime locations such as:
  • K8S: Kubernetes clusters
  • ECS: Amazon Elastic Container Service clusters
  • S3: Amazon S3 buckets
  • docker: Docker containers
  • server: Bare-metal or VM servers
  • lambda: AWS Lambda functions
For aggregating multiple physical environments into logical groups, use the kosli_logical_environment resource.
To attach compliance policies to environments, use the kosli_policy_attachment resource.

Example usage

Environment types

The type attribute must be one of the following physical environment types:
  • K8S - Kubernetes clusters
  • ECS - Amazon Elastic Container Service
  • S3 - Amazon S3 buckets
  • docker - Docker containers
  • server - Bare-metal or VM servers
  • lambda - AWS Lambda functions

Configuration options

Include scaling

The include_scaling attribute (default: false) determines whether scaling events in the environment should be tracked. This is useful for environments with auto-scaling where you want to monitor scale-up and scale-down events.

Import

Environments can be imported using their name:

Monitoring environments

For querying environment metadata such as last_modified_at and last_reported_at timestamps, use the kosli_environment data source. This is useful for monitoring and creating conditional logic based on environment state.

Schema

Required

  • name (String) Name of the environment. Must be unique within the organization. Changing this will force recreation of the resource.
  • type (String) Type of the environment. Valid values: K8S, ECS, S3, docker, server, lambda. Changing this will force recreation of the resource.

Optional

  • description (String) Description of the environment. Explains the purpose and characteristics of this deployment target.
  • include_scaling (Boolean) Whether to include scaling information when reporting environment snapshots. Defaults to false.
  • 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.
Last modified on April 15, 2026