Skip to content

pixie79/terraform-provider-redpanda

Repository files navigation

Terraform Red Panda Provider

This is a custom Terraform provider for managing topics and schemas in Red Panda.

Prerequisites

Building the provider

  1. Clone the repository:
git clone https://github.com/pixie79/terraform-provider-redpanda.git
cd terraform-provider-internal
  1. Build the provider:
go build -o terraform-provider-internal
  1. Install the provider:
mkdir -p ~/.terraform.d/plugins/example.com/local/internal/0.1.0/linux_amd64
mv terraform-provider-internal ~/.terraform.d/plugins/example.com/local/internal/0.1.0/linux_amd64/

Replace linux_amd64 with the appropriate directory for your platform if needed.

Using the provider

  1. Create a main.tf file:
terraform {
  required_providers {
    redpanda = {
      source  = "example.com/local/internal"
      version = "0.1.0"
    }
  }
}

provider "redpanda" {
  api_url = "http://localhost:8081"
}

resource "redpanda_topic" "example_topic" {
  name               = "example-topic"
  partitions         = 3
  replication_factor = 1
}

resource "schema" "example_schema" {
  subject    = "example-topic-value"
  schema     = "{\"type\": \"record\", \"name\": \"example\", \"fields\": [{\"name\": \"field1\", \"type\": \"string\"}]}"
  schema_type = "AVRO"
}

Replace the api_url with the URL to your Red Panda schema registry.

  1. Initialize Terraform:
terraform init
  1. Apply the configuration:
terraform apply
  1. To destroy the created resources:
terraform destroy

License

This project is licensed under the MIT License.

This README.md file provides an overview of the Terraform Red Panda provider, including prerequisites, build instructions, installation, and usage.