This repository contains a Terraform provider for Kong Konnect.
This provider can manage the following resources:
The provider can be installed from the Terraform registry. Before using the provider, you must configure a personal_access_token
. If you are running in a non-US region, you must also set the server_url
configuration option.
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "kpat_YOUR_PAT"
server_url = "https://us.api.konghq.com"
}
You may also configure the provider
block using environment variables:
personal_access_token
= KONNECT_TOKEN
system_account_access_token
= KONNECT_SPAT
server_url
= KONNECT_SERVER_URL
e.g. KONNECT_TOKEN=kpat_YOUR_PAT terraform apply
The examples directory contains sample usage for all supported resources. For a full list of supported parameters for each resource, see the provider documentation.
The examples in this repo reference resources that are expected to exist in your manifests e.g. konnect_gateway_control_plane.tfdemo.id
. Update the references to match the names that you have given your resources.
We are currently working on official data source support (see #10). Until this is ready, you can use the http
data source to call the Konnect API directly.
data "http" "production_cp" {
url = "https://us.api.konghq.com/v2/control-planes?page%5Bsize%5D=1&page%5Bnumber%5D=1&filter%5Bname%5D%5Beq%5D=production"
request_headers = {
Accept = "application/json"
Authorization = "Bearer ${var.konnect_personal_access_token}"
}
}