Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 1.88 KB

README.md

File metadata and controls

94 lines (63 loc) · 1.88 KB

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-redpanda
  1. Build the provider:
go build -o terraform-provider-redpanda
  1. Install the provider:
mkdir -p ~/.terraform.d/plugins/example.com/local/redpanda/0.1.0/linux_amd64
mv terraform-provider-redpanda ~/.terraform.d/plugins/example.com/local/redpanda/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/redpanda"
      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 "redpanda_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.