_This provider is built on the Terraform Plugin Framework. The template repository built on the Terraform Plugin SDK can be found at terraform-provider-scaffolding.
This repository contains a Terraform provider for Redpanda, that enables Terraform to connect to a Redpanda cluster and determine the hostnames of the brokers in use. In provides:
- A single data source (
internal/provider/
), - Miscellaneous meta files.
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install
Make sure the provider is listed in required_providers:
terraform {
...
required_providers {
pmwrp = {
source = "registry.terraform.io/hashicorp/pmwrp"
}
...
}
}
Then, configure the provider by setting the seed address and credentials:
provider "pmwrp" {
seed = "seed-your.cluster.address.here.fmc.prd.cloud.redpanda.com:9092"
username = "your-username-here"
password = "your-password-here"
}
Include a data source within your terraform:
data "pmwrp_brokers" "default" {}
You can then use the broker host names as needed:
locals {
hosts = [for broker in data.pmwrp_brokers.default.brokers: broker.host]
}
output "hosts" {
value = local.hosts
}