Skip to main content
Fetches details of an existing Kosli control. Use this data source to reference controls and access metadata such as the version, tags, and referencing policies.
Controls is a beta feature and must be enabled for your organization; API requests return 403 Forbidden otherwise.
Use this data source to:
  • Reference an existing control managed outside Terraform
  • Read control metadata such as version, tags, and policies_referencing
  • Read a specific historical version of a control’s name, description, and links
  • Read a previously-archived control by opting in with archived = true

Example usage

terraform {
  required_providers {
    kosli = {
      source = "kosli-dev/kosli"
    }
  }
}

# Create a control
resource "kosli_control" "binary_provenance" {
  identifier  = "SDLC-001"
  name        = "Binary provenance"
  description = "All production artifacts must have build provenance attestations"
}

# Look up the control via data source
data "kosli_control" "binary_provenance" {
  identifier = kosli_control.binary_provenance.identifier
}

# Reference control metadata
output "control_version" {
  description = "Current version of the control"
  value       = data.kosli_control.binary_provenance.version
}

output "control_policies" {
  description = "Environment policies referencing the control"
  value       = data.kosli_control.binary_provenance.policies_referencing
}

output "control_tags" {
  description = "Tags on the control"
  value       = data.kosli_control.binary_provenance.tags
}

Read-only access

Data sources provide read-only access to control metadata. To create or modify controls, use the kosli_control resource.

Schema

Required

  • identifier (String) The unique identifier of the control to query (e.g. SDLC-001).

Optional

  • archived (Boolean) Whether the control is archived. Deleting a kosli_control resource archives the control rather than hard-deleting it, and by default reading an archived control fails as if it did not exist. Set to true to read an archived control. Defaults to false.
  • version (Number) Version of the control to read. Every update to a control creates a new version; set this to read the name, description, and links of a specific version. Defaults to the latest version.

Read-only

  • created_at (String) RFC3339 UTC timestamp of when the control was created. When version is set, this is when that version was created.
  • created_by (String) Identifier of the user who created the control. When version is set, this is who created that version.
  • description (String) The description of the control.
  • links (Map of String) Named links related to the control, as a map of link name to URL.
  • name (String) Human-readable display name of the control.
  • policies_referencing (List of String) Names of the environment policies that reference this control.
  • status (String) Status of the requested version (e.g. created). Only populated when version is set; the latest-control endpoint does not report a status.
  • tags (Map of String) Tags on the control, as a map of tag key to value.
Last modified on July 10, 2026