> ## Documentation Index
> Fetch the complete documentation index at: https://kosli-mbevc1-patch-1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# kosli_policy data source

> Fetches details of an existing Kosli policy.

Fetches details of an existing Kosli policy.

Use this data source to reference existing policies and access metadata such as the policy content, description, and latest version number.

## Example usage

```terraform theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
terraform {
  required_providers {
    kosli = {
      source = "kosli-dev/kosli"
    }
  }
}

# Query an existing policy
data "kosli_policy" "production" {
  name = "prod-requirements"
}

output "policy_latest_version" {
  description = "Latest version number of the policy"
  value       = data.kosli_policy.production.latest_version
}

output "policy_content" {
  description = "YAML content of the latest policy version"
  value       = data.kosli_policy.production.content
}
```

## Schema

### Required

* `name` (String) The name of the policy to query.

### Read-only

* `content` (String) YAML content of the latest policy version. Null if the policy has no versions.
* `created_at` (Number) Unix timestamp of when the policy was first created.
* `description` (String) Description of the policy.
* `latest_version` (Number) The version number of the latest policy version. Null if the policy has no versions.
