> ## 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/index",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

# Kosli Terraform Provider

> Manage Kosli resources as Infrastructure-as-Code using Terraform.

The Kosli provider allows you to manage Kosli resources as Infrastructure-as-Code using Terraform. Use it to define and manage environments, policies, actions, custom attestation types, and integrate Kosli into your compliance workflows.

<Note>
  The provider is officially registered at the [Terraform Registry](https://registry.terraform.io/providers/kosli-dev/kosli/latest/docs).
</Note>

## Requirements

* Terraform >= 1.10
* A Kosli account with API credentials

## Example usage

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

# Configure the Kosli Provider
# Authentication via environment variables (recommended)
provider "kosli" {
  # API token - set via KOSLI_API_TOKEN environment variable
  # Organization name - set via KOSLI_ORG environment variable

  # Optional: API endpoint URL (defaults to https://app.kosli.com)
  # api_url = "https://app.us.kosli.com"  # Use US region

  # Optional: HTTP client timeout in seconds (defaults to 30)
  # timeout = 60
}
```

## Authentication

The provider requires a Kosli API token and organization name for authentication. These can be configured in two ways (in order of precedence):

1. **Provider configuration** - Set directly in your Terraform configuration
2. **Environment variables** - Use `KOSLI_API_TOKEN` and `KOSLI_ORG`

### Creating an API token

To create an API token:

1. Log in to [Kosli](https://app.kosli.com)
2. Navigate to **Settings** → **API Tokens**
3. Click **Create Token**
4. Copy the token and store it securely

<Warning>
  API tokens grant full access to your Kosli organization. Store them securely and never commit them to version control.
</Warning>

## Regional endpoints

Kosli operates in multiple regions. Configure the `api_url` to match your organization's region:

* **EU (Default)**: `https://app.kosli.com`
* **US**: `https://app.us.kosli.com`

## Schema

### Optional

* `api_token` (String, Sensitive) Kosli API token for authentication. Can also be set via KOSLI\_API\_TOKEN environment variable.
* `api_url` (String) Kosli API endpoint URL. Defaults to [https://app.kosli.com](https://app.kosli.com) (EU region). Use [https://app.us.kosli.com](https://app.us.kosli.com) for US region. Can also be set via KOSLI\_API\_URL environment variable.
* `org` (String) Kosli organization name. Can also be set via KOSLI\_ORG environment variable.
* `timeout` (Number) HTTP client timeout in seconds. Defaults to 30 seconds.
