Kong / terraform-provider-konnect

Terraform Provider for Kong Konnect
https://registry.terraform.io/providers/kong/konnect/latest
29 stars 7 forks source link

terraform-provider-konnect

This repository contains a Terraform provider for Kong Konnect.

Capabilities

This provider can manage the following resources:

Gateway Manager

Cloud Gateways

Kong Gateway Entities

Mesh

API Products

Dev Portal

Organization

Usage

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:

e.g. KONNECT_TOKEN=kpat_YOUR_PAT terraform apply

Examples

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.

Data Providers

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}"
  }
}