Announcing terraform-provider-konnect v3
It’s been almost a year since we released our Konnect Terraform provider. In that time we’ve seen over 300,000 installs, have 1.7 times as many resources available, and have expanded the provider to include data sources to enable federated management of your Konnect organization.
There have been many changes in the last year, but there are some changes that we’ve been holding off on as they would break your CI/CD pipelines. We’re now in a position where we need to make those changes, and have done the work to make resolving the changes as easy as possible for you.
So, why should you upgrade to version 3? I’m glad you asked!
Developer Portal support
You may have seen Kong’s new Developer Portal, which provides professional, branded API experiences in minutes, but also allows you to customize every detail to your needs. We’ve been providing support for the new Developer Portal through our Beta Konnect Terraform provider, but now it’s time to graduate those resources to the GA provider.
Version 2 of the Konnect provider contains a konnect_portal
resource, which can be used to manage the classic version of Kong’s Developer Portal. In version 3 of the provider, we’re switching the konnect_portal
resource to manage the latest and greatest version of Portals.
If you’re a Portal classic user, don’t worry! The konnect_portal_classic
resource is here to help, and it’s easy to migrate your existing konnect_portal
resources to konnect_portal_classic
. We’ve published documentation that shows how to do it using Terraform manifests, the terraform
CLI (and even by editing state directly if you’re brave). The konnect_portal_classic
resource exists in version 2.14 of the provider, so you can migrate your resources safely before upgrading to version 3.
Support for null configurations
We recently uncovered a tricky edge case in the provider. If you set a value in the provider and later remove it from your manifest, the change isn’t reflected on the server — the value sticks around instead of being cleaned up. If you’ll allow me to put on my engineer hat for a moment, I can explain why this happened:
- The Konnect APIs use JSON Merge Patch for updating entities in the API
- When removing configuration in Terraform, it resulted in an empty object being sent to the API
- This empty object was interpreted as no changes due to JSON merge patch
We’ve been fixing these issues one by one as they’re reported, but we quickly realized that we need a holistic solution. In version 3, if a field isn't explicitly defined in a manifest, we send null
rather than {}
to the API, ensuring that the old configuration is removed.
This work has been extensively tested, and we have automated tests for the most commonly used resources. However, the tests aren’t exhaustive, so please do raise an issue if there's anything that doesn’t work quite as it should in your deployments.
Enhanced data sources
When we added data sources to the 2.x provider, we added them to the list endpoint for each resource. This means that you had to access the data using a long address such as data.konnect_gateway_control_plane_list.all_control_planes.data[0].id
. This is painful, and we’ve seen that users set a temporary variable name that they can reuse to make it easier to work with.
In version 3, that pain goes away. We’ve added the ability to look up individual entities by name:
data "konnect_gateway_control_plane" "my_gatewaycontrolplane" {
filter = {
name = {
eq = "Adopted"
}
}
}
This control plane’s details are accessible as data.konnect_gateway_control_plane.my_gatewaycontrolplane.id
, removing the need for you to assign a temporary variable.
Give it a try
Version 3 of the Konnect Terraform provider is available now through the Hashicorp registry. You can find detailed documentation for each resource in the registry.
If you’re looking for a step-by-step guide, take a look at some of our Terraform pages on the Kong Developer site.
- How to automate your API catalog with Terraform
- Configure Basic Auth using Kong Gateway and Terraform
- Manage analytics dashboards with Terraform
If you’re comfortable with Terraform, we have a larger catalog of scenarios available on GitHub that only contain the resources required to meet a specific use case without any words.
Finally, if you can’t find what you’re looking for, please let us know by raising an issue on Kong Developer.