Skip to content

alexashley/terraform-provider-kong

Repository files navigation

terraform-provider-kong

CircleCI

A Terraform provider for the api gateway Kong.

Features

  • Supports Kong's Enterprise authentication
  • Resources for individual plugins, including EE-only plugins
  • Import individual consumers, services, routes, or plugins
  • Bulk import tool to ease migrating existing infrastructure into Terraform

Unsupported Resources

No plans to support the legacy API resource.

I also don't intend to add support for the following resources, since I don't currently use them:

That said, PRs are welcome and may I try to implement them once the other resources are mature.

Development

  • install Go 1.11 (this project uses Go modules)
  • install Terraform.
  • docker-compose up --build -d to stand up an instance of Kong 0.14 CE w/ Postgres.
  • make build to create the provider.
  • make example to run the provider against Kong.

Adding a new resource

  • If you're adding a new plugin, use the generic_plugin_resource to abstract the Terraform operations for the plugin.
    • Supply one function that maps the resource to the plugin config (provider.ConfigMapper)
    • And another function to map from the plugin's API representation to Terraform state (provider.ResourceMapper)
  • For all resources, add a new YAML file under docsgen/resource-metadata with information about the resource
    • Documentation is generated by reading the provider, so you must supply a description for each field