RabbitMQ is an AMQP message broker server. The RabbitMQ provider exposes resources used to manage the configuration of resources in a RabbitMQ server.
The provider supports versions 4.0.x
, 3.13.x
and 3.12.x
of RabbitMQ. It may still work with versions 3.11.x
, 3.10.x
, 3.9.x
and 3.8.x
, however these versions are no longer officialy supported.
For information on RabbitMQ versions, see the RabbitMQ Release Information.
# 1. Specify the version of the RabbitMQ Provider to use
terraform {
required_providers {
rabbitmq = {
source = "rfd59/rabbitmq"
version = "2.1.0"
}
}
}
# 2. Configure the RabbitMQ Provider
provider "rabbi" {
# The RabbitMQ management plugin must be enabled on the server, to use this provider.
# You can enable the plugin by doing something similar to `$ sudo rabbitmq-plugins enable rabbitmq_management`
# https://www.rabbitmq.com/docs/management
endpoint = "http://127.0.0.1:15672"
username = "guest"
password = "guest"
}
# 3. Create a Virtual Hosts into the RabbitMQ Server
resource "rabbitmq_vhost" "example" {
name = "vhost_example"
}
- Terraform 1.0.x
- Go 1.21
- Docker Engine >= 27.2.x
- Docker Compose plugin >= 2.29.x
-
Fork and Clone this repository localy
-
To compile the provider, run
make build
. This will build the provider and put the provider binary in the$GOPATH/bin
directory.\$ make build ... \$ $GOPATH/bin/terraform-provider-rabbitmq ...
To find the '${GOPATH}', you can run
go env GOPATH
. -
In order to run the full suite of Acceptance tests, run
make testacc
.\$ make testacc
-
In order to build the Provider documentation, run
make doc
.\$ make doc
To launch the examples terraform scripts with your local Provider, follow these steps:
-
Into your home folder, add/update the
~/.terraformrc
file with:provider_installation { dev_overrides { "rfd59/rabbitmq" = "${GOPATH}/bin" } # For all other providers, install them directly from their origin provider # registries as normal. If you omit this, Terraform will _only_ use # the dev_overrides block, and so no other providers will be available. direct {} }
To find the '${GOPATH}', you can run
go env GOPATH
. -
Launch a RabbitMQ engine by
./scripts/testacc.sh setup
command.The RabbitMQ console will be available by http://localhost:15672 (guest/guest)
-
If it's not already done, build you local Provider by
make build
command. -
Launch
terraform -chdir=./examples/... apply
to apply the example.