Skip to content

adragomir/terraform-provider-kafka

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Kafka Topic Provider

This is a Terraform provider for managing Kafka topics with Terraform.

Why use this Kafka provider?

  • Supports adding partitions and altering configs
  • Supports TLS/SASL
  • Uses Kafka's new admin APIs rather than shelling out to old bash scripts

Installation

  1. Download the latest compiled binary from GitHub releases.

  2. Unzip/untar the archive.

  3. Move it into $HOME/.terraform.d/plugins:

    $ mkdir -p $HOME/.terraform.d/plugins
    $ mv terraform-provider-kafka $HOME/.terraform.d/plugins/terraform-provider-kafka
  4. Create your Terraform configurations as normal, and run terraform init:

    $ terraform init

    This will find the plugin locally.

Usage

  1. Create a Terraform configuration file:

    provider "kafka" {
    	hosts = ["localhost:9092"]
    }
    
    resource "kafka_topic" "example" {
    	name: "example"
    	num_partitions: "8"
    	replication_factor: "1"
    	config_entries: {
    		retention.bytes: "102400"
    		cleanup.policy: "compact
    	}
    }

    There's parameters to set if you use TLS/SASL.

  2. Run terraform init to pull in the provider:

    $ terraform init
  3. Run terraform plan and terraform apply to interact with the filesystem:

    $ terraform plan
    
    $ terraform apply

Importing topics

This provider supports importing externally created topics by their name. Assuming you've already created a topic declaration like the one above, you can get Terraform to manage the state of the existing topic:

$ terraform import kafka_topic.example example

Examples

For more examples, please see the examples folder in this repository.

License

MIT


About

Terraform provider for managing Kafka topics.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 74.4%
  • Makefile 25.6%