# Coralogix Terraform Provider

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Finfrastructure-as-code%2Fterraform-provider%2Fcoralogix-terraform-provider.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdeveloper-portal%2Finfrastructure-as-code%2Fterraform-provider%2Fcoralogix-terraform-provider.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

The Coralogix Terraform provider lets you manage Coralogix resources (alerts, dashboards, TCO policies, recording rules, SLOs, webhooks, enrichment, and more) as infrastructure code. It requires **Terraform v1.3.0 or later**.

For the full resource and data source reference, see the [Terraform Registry](https://registry.terraform.io/providers/coralogix/coralogix/latest/docs). Source code and examples are on [GitHub](https://github.com/coralogix/terraform-provider-coralogix/tree/master/examples).

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* A Coralogix account on the [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md) matching your data residency region, or a tenant in the [FedRAMP](https://coralogix.com/docs/user-guides/account-management/fedramp.md) environment.
* A [personal or team API key](https://coralogix.com/docs/user-guides/account-management/api-keys/api-keys.md#overview) with permissions for the resources you intend to manage. Permission presets are recommended. They stay up to date automatically.
* [Terraform installed](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli).

## Configuration[​](#configuration "Direct link to Configuration")

### Provider block[​](#provider-block "Direct link to Provider block")

```
terraform {

  required_providers {

    coralogix = {

      source  = "coralogix/coralogix"

      version = "~> 3.0"

    }

  }

}



provider "coralogix" {

  api_key = "<your API key>"

  env     = "<your region>"  # EU1, EU2, US1, US2, US3, AP1, AP2, AP3

}
```

### Authentication[​](#authentication "Direct link to Authentication")

Set credentials explicitly in the provider block (shown above), or via environment variables:

```
export CORALOGIX_API_KEY="<your API key>"

export CORALOGIX_ENV="<your region>"
```

Environments that `env` does not cover, including FedRAMP, use `CORALOGIX_DOMAIN` in place of `CORALOGIX_ENV`.

### Provider arguments[​](#provider-arguments "Direct link to Provider arguments")

| Argument  | Type               | Description                                                                                                                                                                                                                     |
| --------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key` | string (sensitive) | API key with permissions for the resources you are managing                                                                                                                                                                     |
| `env`     | string             | Region matching your Coralogix [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md). One of `EU1`, `EU2`, `US1`, `US2`, `US3`, `AP1`, `AP2`, `AP3`. Conflicts with `domain` |
| `domain`  | string             | Coralogix hostname to target, for environments that `env` does not cover: the FedRAMP environment, or an AWS PrivateLink management host such as `api.private.eu2.coralogix.com`. Conflicts with `env`                          |

Set `env` or `domain`, never both. The provider rejects a configuration that sets both, and one of them is required.

### FedRAMP and AWS GovCloud[​](#fedramp-and-aws-govcloud "Direct link to FedRAMP and AWS GovCloud")

The [FedRAMP](https://coralogix.com/docs/user-guides/account-management/fedramp.md) environment is not one of the values `env` accepts. `env = "GOV1"` fails validation. Use `domain` instead:

```
provider "coralogix" {

  api_key = "<your API key>"

  domain  = "gov1.coralogixgov.us"

}
```

Or through the environment:

```
export CORALOGIX_API_KEY="<your API key>"

export CORALOGIX_DOMAIN="gov1.coralogixgov.us"
```

The provider derives its API targets from that hostname: `ng-api-grpc.gov1.coralogixgov.us:443` for gRPC calls and `https://api.gov1.coralogixgov.us` for REST calls. Use an API key issued in your FedRAMP tenant. A key from a commercial Coralogix account does not authenticate against the FedRAMP environment.

If you connect over AWS PrivateLink from AWS GovCloud, set `domain` to the private management host instead. The provider recognizes an `api.private.` prefix and targets that host directly rather than prefixing it.

## Resources and data sources[​](#resources-and-data-sources "Direct link to Resources and data sources")

The provider covers alerts, dashboards, TCO policies, recording rules, SLOs, webhooks, enrichment, and more. For the full list with usage examples, see the [Terraform Registry documentation](https://registry.terraform.io/providers/coralogix/coralogix/latest/docs).

## Report issues[​](#report-issues "Direct link to Report issues")

Found a bug or want to contribute? Open an issue on [GitHub](https://github.com/coralogix/terraform-provider-coralogix/issues).
