Skip to content

kapicic/terraform-provider-kong-konnect

Repository files navigation

kong Terraform Provider

The Konnect platform API This repository contains a Terraform provider that allows you to manage resources through the kong API.

Prerequisites

Installing The Provider

  1. Clone the repository:
git clone https://github.com/liblaber/terraform-provider-kong.git
  1. Navigate to the directory:
cd terraform-provider-kong
  1. Update module references:
go mod tidy
  1. Build the provider:
go build -o terraform-provider-kong
  1. Move the provider to your plugins directory:
mkdir -p ~/.terraform.d/plugins/example.com/user/kong/<version>/<distribution>
mv terraform-provider-kong ~/.terraform.d/plugins/example.com/user/kong/<version>/<distribution>

Note: The directory structure is important. The provider must be located at ~/.terraform.d/plugins/example.com/user/kong/<version>/<distribution>/terraform-provider-kong Also please change example.com/user, <version> and <distribution> to match your real values. <version> must match a semver. To get the run terraform version, possible values: linux_amd64, darwin_arm64, windows_amd64, etc.

Setting Up The Provider

  1. Configure the provider:

In your Terraform configuration, reference the provider and supply the necessary credentials:

provider "kong" {
host = "https://localhost/"
api_token = "YOUR_API_TOKEN"
}

Running The Provider

To plan and apply your Terraform configuration:

  1. Initialize your configuration:
terraform init -plugin-dir=~/.terraform.d/plugins
  1. Plan your changes:
terraform plan
  1. Apply your configuration:
terraform apply

Debugging

If you encounter any issues or unexpected behaviors, enable debug mode by setting the environment variable:

export TF_PROVIDER_DEBUG=true

Then, run your Terraform commands.

Running Tests

  1. Generate the docs:
go generate ./...
  1. To execute the provider's tests, follow these steps:

a. Run Unit Tests:

make unit-test

b. Run Acceptance Tests:

make acceptance-test

Publishing the Provider

  1. Tag your release:
git tag v<version>
git push --tags
  1. Build a release binary for your platform:
GOOS=linux GOARCH=amd64 go build -o terraform-provider-kong
  1. Upload the binary to the GitHub release or any other distribution method you prefer.

Note: For wide-reaching utility, consider registering your provider with the official Terraform provider registry once it becomes popular within the community.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published