Explore the docs »
Report Bug
·
Request Feature
·
Contact support
·
·
·
·
This repository contains the Conduktor Terraform provider, which defines Conduktor resources so that they can be deployed using Infrastructure as Code (IaC).
Warning
- The Conduktor Terraform provider is currently in Alpha.
- It does not support all Console and Gateway resources yet. See our resources roadmap.
- Let us know if you have feedback or wish to be a design partner.
Table of Contents
- Console user
- Console group
- Kafka Clusters with Schema Registry
- Kafka Connect Server
- Generic
⚠️ This resource is experimental and should be used with care.
Provider should be installed automatically with terraform init
, but it's recommended to pin a specific version or range of versions using the following required_providers
configuration :
terraform {
required_providers {
conduktor = {
source = "conduktor/conduktor"
version = "~> X.Y" # where X.Y is the current major version and minor version
}
}
}
# configure provider
provider "conduktor" {
console_url = "http://localhost:8080"
api_token = "your-api-key" # can also use admin email/password to authenticate.
}
# register an external user bob with PLATFORM.userView permission
resource "conduktor_user_v2" "bob" {
name = "[email protected]"
spec {
firstname = "Bob"
lastname = "Smith"
permissions = [
{
permissions = [ "userView" ]
resource_type = "PLATFORM"
},
]
}
}
# create a group with Bob as a member
resource "conduktor_group_v2" "qa" {
name = "qa"
spec {
display_name = "QA team"
description = "Quality Assurance team"
members = [ conduktor_user_v2.bob.name ]
permissions = [
{
resource_type = "PLATFORM"
permissions = ["userView", "clusterConnectionsManage"]
}
]
}
}
You can find more examples in this repository inside example
directory.
Examples can also be found in provider reference documentation available either in docs
directory or at registry.terraform.io/conduktor/conduktor
You can also check out our documentation for resources reference and provider usage.
To use Conduktor Console API, the Terraform provider needs to authenticate against it.
For that we offer two possibilities:
Use an already manually forged API key. See documentation to create one.
Using HCL api_token
attribute
provider "conduktor" {
api_token = "your-api-key"
}
Using environment variables CDK_API_TOKEN
or CDK_API_KEY
.
Use local user (usually admin) credentials pair. This will login against the API and use an ephemeral access token to make API calls.
Using HCL admin_email
/admin_password
attributes
provider "conduktor" {
admin_email = "[email protected]"
admin_password = "admin-password"
}
Using environment variables CDK_ADMIN_EMAIL
or CDK_ADMIN_PASSWORD
.
Either way be aware that API Key and admin credentials are sensitive data and should be stored and provided to Terraform properly.
- Terraform >= 1.0
- Go >= 1.23
- Docker with compose to run acceptance tests locally
- Git hooks to format/lint code before committing
Please install the git hooks to ensure that the code is formatted correctly and pass linter check before committing.
Run make install-githooks
to install the git hooks.
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
Will build and install terraform provider locally in ~/.terraform.d/plugins
directory.
Local provider version is set on VERSION
variable of GNUmakefile
VERSION=0.0.1 make deploy-locally
It can then be used on terraform recipe like
terraform {
required_providers {
conduktor = {
source = "terraform.local/conduktor/conduktor" # local provider
version = ">= 0.0.1" # latest version found locally in the plugin cache.
}
}
}
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency
to your Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod
and go.sum
.
The project uses different codegen tool to generate source files.
Documentation in docs
folder is generated using tfplugindocs
Terraform schema definition in schema
module are generated using tfplugingen-framework from currently manually maintained code spec json file.
# Optional
export CDK_LICENSE="your_license_here"
make testacc
This action will start a testing environment using Docker Compose and run all acceptance tests against it. Test environment is destroyed at the end.
You can also start/stop environment and run tests in separate actions using make start_test_env
/ make test
/ make clean
.
make generate # run go generate
make build # run build
make go-fmt # run go fmt on the project
make go-lint # run golangci-lint linter
Future versions of the Conduktor Terraform provider will evolve to support more resources.
Need a resource to unblock a use case? Feedback to the Product team directly.
We are currently reviewing the following resources:
- Console resources:
- Kafka resources:
- Self-service resources:
- Gateway resources:
Note
This list is not exhaustive and can change depending on requests and needs.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.