> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kosli.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/terraform-reference/data-sources/policy",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# 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.
