From 39760fac279b3dbb22edcb17d233ceb7e0d56164 Mon Sep 17 00:00:00 2001 From: Raymond Fallon Date: Wed, 17 Jun 2020 13:19:59 -0400 Subject: [PATCH] Add a more complete federation example. --- .../docs/r/federation-upstream.html.markdown | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/website/docs/r/federation-upstream.html.markdown b/website/docs/r/federation-upstream.html.markdown index e96710a6..c810818a 100644 --- a/website/docs/r/federation-upstream.html.markdown +++ b/website/docs/r/federation-upstream.html.markdown @@ -27,12 +27,24 @@ resource "rabbitmq_permissions" "guest" { } } +// downstream exchange +resource "rabbitmq_exchange" "foo" { + name = "foo" + vhost = rabbitmq_permissions.guest.vhost + + settings { + type = "topic" + durable = "true" + } +} + +// upstream broker resource "rabbitmq_federation_upstream" "foo" { name = "foo" vhost = rabbitmq_permissions.guest.vhost definition { - uri = "amqp://server-name" + uri = "amqp://guest:guest@upstream-server-name:5672/%2f" prefetch_count = 1000 reconnect_delay = 5 ack_mode = "on-confirm" @@ -41,6 +53,21 @@ resource "rabbitmq_federation_upstream" "foo" { } } +resource "rabbitmq_policy" "foo" { + name = "foo" + vhost = rabbitmq_permissions.guest.vhost + + policy { + pattern = "(^${rabbitmq_exchange.foo.name}$)" + priority = 1 + apply_to = "exchanges" + + definition = { + federation-upstream = rabbitmq_federation_upstream.foo.name + } + } +} + ``` ## Argument Reference