Home

Awesome

Terraform Provider Kong

The Kong Terraform Provider tested against real Kong!

v5.0.0 of the provider supports Terraform 0.12

IMPORTANT

The provider has been updated to support Kong v2.X, there were some breaking changes made between Kong v1 and v2. To use Kong v1 use provider version v6.X.X. That version will no longer be maintained.

Requirements

Usage

First, install the desired plugin release following Terraform's Third-party plugin docs.

To configure the provider:

provider "kong" {
    kong_admin_uri = "http://myKong:8001"
}

Optionally you can configure Username and Password for BasicAuth:

provider "kong" {
    kong_admin_uri  = "http://myKong:8001"
    kong_admin_username = "youruser"
    kong_admin_password = "yourpass"
}

You can use environment variables to set the provider properties instead. The following table shows all of the config options, the corresponding environment variables and their property defaults if you do not set them. When using the kong_api_key parameter ensure that the key name parameter in the key-auth plugin is set to apikey.

Provider propertyEnv variableDefault if not setUse
kong_admin_uriKONG_ADMIN_ADDRhttp://localhost:8001The url of the kong admin api
kong_admin_usernameKONG_ADMIN_USERNAMEnot setUsername for the kong admin api
kong_admin_passwordKONG_ADMIN_PASSWORDnot setPassword for the kong admin api
tls_skip_verifyTLS_SKIP_VERIFYfalseWhether to skip tls certificate verification for the kong api when using https
kong_api_keyKONG_API_KEYnot setAPI key used to secure the kong admin API
kong_admin_tokenKONG_ADMIN_TOKENnot setAPI key used to secure the kong admin API in the Enterprise Edition
strict_plugins_matchSTRICT_PLUGINS_MATCHfalseShould plugins config_json field strictly match plugin configuration

Documentation

For documentation on how to use the provider see the documentation on the Hashicorp Terraform Registry for this provider

Contributing

I would love to get contributions to the project so please feel free to submit a PR. To setup your dev station you need go and docker installed.

Once you have cloned the repository the env TF_ACC=1 make command will build the code and run all of the tests. If they all pass then you are good to go!

If when you run the make command you get the following error:

goimports needs running on the following files:

Then all you need to do is run make goimports this will reformat all of the code (I know awesome)!!

Please write tests for your new feature/bug fix, PRs will only be accepted with covering tests and where all tests pass. If you want to start work on a feature feel free to open a PR early so we can discuss it or if you need help.