The provider is officially registered at the Terraform Registry.
Requirements
- Terraform >= 1.10
- A Kosli account with API credentials
Example usage
Authentication
The provider requires a Kosli API token and organization name for authentication. These can be configured in two ways (in order of precedence):- Provider configuration - Set directly in your Terraform configuration
- Environment variables - Use
KOSLI_API_TOKENandKOSLI_ORG
Creating an API token
To create an API token:- Log in to Kosli
- Navigate to Settings → API Tokens
- Click Create Token
- Copy the token and store it securely
Required permissions
Use a token that belongs to a user or service account with the Admin role. Some provider operations are restricted to admins. Destroying akosli_environment or kosli_logical_environment archives the environment in Kosli, and archiving requires the Admin role. With a Member token, terraform apply can create and update environments. However, terraform destroy (or removing the resource from your configuration) fails with 403 Forbidden and the resource stays in state.
The recommended setup is a dedicated service account with the admin privilege and an API key minted for it. You can create both in the Kosli UI under Settings → Service Accounts, or with the kosli_service_account and kosli_service_account_api_key resources. The initial bootstrap with these resources must itself run with an Admin token, because a service account cannot be granted a higher privilege than the caller’s.
Regional endpoints
Kosli operates in multiple regions. Configure theapi_url to match your organization’s region:
- EU (Default):
https://app.kosli.com - US:
https://app.us.kosli.com
api_url must use https. Plain http is only accepted for localhost.
Telemetry
Alongside theUser-Agent, every request the provider sends to Kosli carries these headers, which Kosli uses to understand how the provider is used:
X-Kosli-Client: the provider name and version, for exampleterraform/v0.11.0X-Kosli-Operation: the resource, data source, or list resource type and the operation, for examplekosli_environment createordata.kosli_flow readX-Kosli-Invocation-Id: a random ID generated each time Terraform starts the provider, which groups the requests from that run
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 (EU region). Use https://app.us.kosli.com for US region. Must use https; plain http is only accepted for localhost. 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.