The RabbitMQ Terraform Provider allows you to declaratively manage RabbitMQ resources such as virtual hosts, users, permissions, and more.
It supports RabbitMQ versions 4.1.x, 4.0.x, 3.13.x, and 3.12.x. Older releases (3.11.x to 3.8.x) may still work but are no longer officially supported.
➡️ See the official RabbitMQ release information for details.
terraform {
required_providers {
rabbitmq = {
source = "rfd59/rabbitmq"
version = "2.6.0"
}
}
}
provider "rabbitmq" {
# The RabbitMQ management plugin must be enabled.
# Enable with: $ sudo rabbitmq-plugins enable rabbitmq_management
# Docs: https://www.rabbitmq.com/docs/management
endpoint = "http://127.0.0.1:15672"
username = "guest"
password = "guest"
}
resource "rabbitmq_vhost" "example" {
name = "vhost_example"
}- Terraform 1.0+
- Go 1.24
- Docker Engine >= 27.2.x
- Docker Compose plugin >= 2.29.x
# Clone your fork
git clone [email protected]:<your-username>/terraform-provider-rabbitmq.git
cd terraform-provider-rabbitmq
# Compile
make build
$GOPATH/bin/terraform-provider-rabbitmq👉 To check your GOPATH:
go env GOPATHmake testaccmake doc-
Add or update your
~/.terraformrc:provider_installation { dev_overrides { "rfd59/rabbitmq" = "${GOPATH}/bin" } direct {} }
-
Start RabbitMQ locally:
./scripts/testacc.sh setup
➡️ Console available at http://localhost:15672 (user:
guest/ password:guest) -
Build the provider:
make build
-
Apply examples:
terraform -chdir=./examples/... apply
Contributions are welcome!
Please open an issue first to discuss what you would like to change.
Guidelines:
- Format code with gofmt
gofmt -w . - Lint with golangci-lint
golangci-lint run - Write unit tests for new features
- Open a Pull Request to develop branch.
This project is licensed under the MIT License.