rabbitmq logo
RabbitMQ v3.3.0, Mar 22 23

rabbitmq.Binding

The rabbitmq.Binding resource creates and manages a binding relationship between a queue an exchange.

Example Usage

using System.Collections.Generic;
using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;

return await Deployment.RunAsync(() => 
{
    var testVHost = new RabbitMQ.VHost("testVHost");

    var guest = new RabbitMQ.Permissions("guest", new()
    {
        PermissionDetails = new RabbitMQ.Inputs.PermissionsPermissionsArgs
        {
            Configure = ".*",
            Read = ".*",
            Write = ".*",
        },
        User = "guest",
        Vhost = testVHost.Name,
    });

    var testExchange = new RabbitMQ.Exchange("testExchange", new()
    {
        Settings = new RabbitMQ.Inputs.ExchangeSettingsArgs
        {
            AutoDelete = true,
            Durable = false,
            Type = "fanout",
        },
        Vhost = guest.Vhost,
    });

    var testQueue = new RabbitMQ.Queue("testQueue", new()
    {
        Settings = new RabbitMQ.Inputs.QueueSettingsArgs
        {
            AutoDelete = false,
            Durable = true,
        },
        Vhost = guest.Vhost,
    });

    var testBinding = new RabbitMQ.Binding("testBinding", new()
    {
        Destination = testQueue.Name,
        DestinationType = "queue",
        RoutingKey = "#",
        Source = testExchange.Name,
        Vhost = testVHost.Name,
    });

});
package main

import (
	"github.com/pulumi/pulumi-rabbitmq/sdk/v3/go/rabbitmq"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testVHost, err := rabbitmq.NewVHost(ctx, "testVHost", nil)
		if err != nil {
			return err
		}
		guest, err := rabbitmq.NewPermissions(ctx, "guest", &rabbitmq.PermissionsArgs{
			Permissions: &rabbitmq.PermissionsPermissionsArgs{
				Configure: pulumi.String(".*"),
				Read:      pulumi.String(".*"),
				Write:     pulumi.String(".*"),
			},
			User:  pulumi.String("guest"),
			Vhost: testVHost.Name,
		})
		if err != nil {
			return err
		}
		testExchange, err := rabbitmq.NewExchange(ctx, "testExchange", &rabbitmq.ExchangeArgs{
			Settings: &rabbitmq.ExchangeSettingsArgs{
				AutoDelete: pulumi.Bool(true),
				Durable:    pulumi.Bool(false),
				Type:       pulumi.String("fanout"),
			},
			Vhost: guest.Vhost,
		})
		if err != nil {
			return err
		}
		testQueue, err := rabbitmq.NewQueue(ctx, "testQueue", &rabbitmq.QueueArgs{
			Settings: &rabbitmq.QueueSettingsArgs{
				AutoDelete: pulumi.Bool(false),
				Durable:    pulumi.Bool(true),
			},
			Vhost: guest.Vhost,
		})
		if err != nil {
			return err
		}
		_, err = rabbitmq.NewBinding(ctx, "testBinding", &rabbitmq.BindingArgs{
			Destination:     testQueue.Name,
			DestinationType: pulumi.String("queue"),
			RoutingKey:      pulumi.String("#"),
			Source:          testExchange.Name,
			Vhost:           testVHost.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.rabbitmq.VHost;
import com.pulumi.rabbitmq.Permissions;
import com.pulumi.rabbitmq.PermissionsArgs;
import com.pulumi.rabbitmq.inputs.PermissionsPermissionsArgs;
import com.pulumi.rabbitmq.Exchange;
import com.pulumi.rabbitmq.ExchangeArgs;
import com.pulumi.rabbitmq.inputs.ExchangeSettingsArgs;
import com.pulumi.rabbitmq.Queue;
import com.pulumi.rabbitmq.QueueArgs;
import com.pulumi.rabbitmq.inputs.QueueSettingsArgs;
import com.pulumi.rabbitmq.Binding;
import com.pulumi.rabbitmq.BindingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var testVHost = new VHost("testVHost");

        var guest = new Permissions("guest", PermissionsArgs.builder()        
            .permissions(PermissionsPermissionsArgs.builder()
                .configure(".*")
                .read(".*")
                .write(".*")
                .build())
            .user("guest")
            .vhost(testVHost.name())
            .build());

        var testExchange = new Exchange("testExchange", ExchangeArgs.builder()        
            .settings(ExchangeSettingsArgs.builder()
                .autoDelete(true)
                .durable(false)
                .type("fanout")
                .build())
            .vhost(guest.vhost())
            .build());

        var testQueue = new Queue("testQueue", QueueArgs.builder()        
            .settings(QueueSettingsArgs.builder()
                .autoDelete(false)
                .durable(true)
                .build())
            .vhost(guest.vhost())
            .build());

        var testBinding = new Binding("testBinding", BindingArgs.builder()        
            .destination(testQueue.name())
            .destinationType("queue")
            .routingKey("#")
            .source(testExchange.name())
            .vhost(testVHost.name())
            .build());

    }
}
import pulumi
import pulumi_rabbitmq as rabbitmq

test_v_host = rabbitmq.VHost("testVHost")
guest = rabbitmq.Permissions("guest",
    permissions=rabbitmq.PermissionsPermissionsArgs(
        configure=".*",
        read=".*",
        write=".*",
    ),
    user="guest",
    vhost=test_v_host.name)
test_exchange = rabbitmq.Exchange("testExchange",
    settings=rabbitmq.ExchangeSettingsArgs(
        auto_delete=True,
        durable=False,
        type="fanout",
    ),
    vhost=guest.vhost)
test_queue = rabbitmq.Queue("testQueue",
    settings=rabbitmq.QueueSettingsArgs(
        auto_delete=False,
        durable=True,
    ),
    vhost=guest.vhost)
test_binding = rabbitmq.Binding("testBinding",
    destination=test_queue.name,
    destination_type="queue",
    routing_key="#",
    source=test_exchange.name,
    vhost=test_v_host.name)
import * as pulumi from "@pulumi/pulumi";
import * as rabbitmq from "@pulumi/rabbitmq";

const testVHost = new rabbitmq.VHost("testVHost", {});
const guest = new rabbitmq.Permissions("guest", {
    permissions: {
        configure: ".*",
        read: ".*",
        write: ".*",
    },
    user: "guest",
    vhost: testVHost.name,
});
const testExchange = new rabbitmq.Exchange("testExchange", {
    settings: {
        autoDelete: true,
        durable: false,
        type: "fanout",
    },
    vhost: guest.vhost,
});
const testQueue = new rabbitmq.Queue("testQueue", {
    settings: {
        autoDelete: false,
        durable: true,
    },
    vhost: guest.vhost,
});
const testBinding = new rabbitmq.Binding("testBinding", {
    destination: testQueue.name,
    destinationType: "queue",
    routingKey: "#",
    source: testExchange.name,
    vhost: testVHost.name,
});
resources:
  testVHost:
    type: rabbitmq:VHost
  guest:
    type: rabbitmq:Permissions
    properties:
      permissions:
        configure: .*
        read: .*
        write: .*
      user: guest
      vhost: ${testVHost.name}
  testExchange:
    type: rabbitmq:Exchange
    properties:
      settings:
        autoDelete: true
        durable: false
        type: fanout
      vhost: ${guest.vhost}
  testQueue:
    type: rabbitmq:Queue
    properties:
      settings:
        autoDelete: false
        durable: true
      vhost: ${guest.vhost}
  testBinding:
    type: rabbitmq:Binding
    properties:
      destination: ${testQueue.name}
      destinationType: queue
      routingKey: '#'
      source: ${testExchange.name}
      vhost: ${testVHost.name}

Create Binding Resource

new Binding(name: string, args: BindingArgs, opts?: CustomResourceOptions);
@overload
def Binding(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            arguments: Optional[Mapping[str, Any]] = None,
            arguments_json: Optional[str] = None,
            destination: Optional[str] = None,
            destination_type: Optional[str] = None,
            routing_key: Optional[str] = None,
            source: Optional[str] = None,
            vhost: Optional[str] = None)
@overload
def Binding(resource_name: str,
            args: BindingArgs,
            opts: Optional[ResourceOptions] = None)
func NewBinding(ctx *Context, name string, args BindingArgs, opts ...ResourceOption) (*Binding, error)
public Binding(string name, BindingArgs args, CustomResourceOptions? opts = null)
public Binding(String name, BindingArgs args)
public Binding(String name, BindingArgs args, CustomResourceOptions options)
type: rabbitmq:Binding
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args BindingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BindingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BindingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Binding Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Binding resource accepts the following input properties:

Destination string

The destination queue or exchange.

DestinationType string

The type of destination (queue or exchange).

Source string

The source exchange.

Vhost string

The vhost to create the resource in.

Arguments Dictionary<string, object>

Additional key/value arguments for the binding.

ArgumentsJson string
RoutingKey string

A routing key for the binding.

Destination string

The destination queue or exchange.

DestinationType string

The type of destination (queue or exchange).

Source string

The source exchange.

Vhost string

The vhost to create the resource in.

Arguments map[string]interface{}

Additional key/value arguments for the binding.

ArgumentsJson string
RoutingKey string

A routing key for the binding.

destination String

The destination queue or exchange.

destinationType String

The type of destination (queue or exchange).

source String

The source exchange.

vhost String

The vhost to create the resource in.

arguments Map<String,Object>

Additional key/value arguments for the binding.

argumentsJson String
routingKey String

A routing key for the binding.

destination string

The destination queue or exchange.

destinationType string

The type of destination (queue or exchange).

source string

The source exchange.

vhost string

The vhost to create the resource in.

arguments {[key: string]: any}

Additional key/value arguments for the binding.

argumentsJson string
routingKey string

A routing key for the binding.

destination str

The destination queue or exchange.

destination_type str

The type of destination (queue or exchange).

source str

The source exchange.

vhost str

The vhost to create the resource in.

arguments Mapping[str, Any]

Additional key/value arguments for the binding.

arguments_json str
routing_key str

A routing key for the binding.

destination String

The destination queue or exchange.

destinationType String

The type of destination (queue or exchange).

source String

The source exchange.

vhost String

The vhost to create the resource in.

arguments Map<Any>

Additional key/value arguments for the binding.

argumentsJson String
routingKey String

A routing key for the binding.

Outputs

All input properties are implicitly available as output properties. Additionally, the Binding resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

PropertiesKey string

A unique key to refer to the binding.

Id string

The provider-assigned unique ID for this managed resource.

PropertiesKey string

A unique key to refer to the binding.

id String

The provider-assigned unique ID for this managed resource.

propertiesKey String

A unique key to refer to the binding.

id string

The provider-assigned unique ID for this managed resource.

propertiesKey string

A unique key to refer to the binding.

id str

The provider-assigned unique ID for this managed resource.

properties_key str

A unique key to refer to the binding.

id String

The provider-assigned unique ID for this managed resource.

propertiesKey String

A unique key to refer to the binding.

Look up Existing Binding Resource

Get an existing Binding resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BindingState, opts?: CustomResourceOptions): Binding
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arguments: Optional[Mapping[str, Any]] = None,
        arguments_json: Optional[str] = None,
        destination: Optional[str] = None,
        destination_type: Optional[str] = None,
        properties_key: Optional[str] = None,
        routing_key: Optional[str] = None,
        source: Optional[str] = None,
        vhost: Optional[str] = None) -> Binding
func GetBinding(ctx *Context, name string, id IDInput, state *BindingState, opts ...ResourceOption) (*Binding, error)
public static Binding Get(string name, Input<string> id, BindingState? state, CustomResourceOptions? opts = null)
public static Binding get(String name, Output<String> id, BindingState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arguments Dictionary<string, object>

Additional key/value arguments for the binding.

ArgumentsJson string
Destination string

The destination queue or exchange.

DestinationType string

The type of destination (queue or exchange).

PropertiesKey string

A unique key to refer to the binding.

RoutingKey string

A routing key for the binding.

Source string

The source exchange.

Vhost string

The vhost to create the resource in.

Arguments map[string]interface{}

Additional key/value arguments for the binding.

ArgumentsJson string
Destination string

The destination queue or exchange.

DestinationType string

The type of destination (queue or exchange).

PropertiesKey string

A unique key to refer to the binding.

RoutingKey string

A routing key for the binding.

Source string

The source exchange.

Vhost string

The vhost to create the resource in.

arguments Map<String,Object>

Additional key/value arguments for the binding.

argumentsJson String
destination String

The destination queue or exchange.

destinationType String

The type of destination (queue or exchange).

propertiesKey String

A unique key to refer to the binding.

routingKey String

A routing key for the binding.

source String

The source exchange.

vhost String

The vhost to create the resource in.

arguments {[key: string]: any}

Additional key/value arguments for the binding.

argumentsJson string
destination string

The destination queue or exchange.

destinationType string

The type of destination (queue or exchange).

propertiesKey string

A unique key to refer to the binding.

routingKey string

A routing key for the binding.

source string

The source exchange.

vhost string

The vhost to create the resource in.

arguments Mapping[str, Any]

Additional key/value arguments for the binding.

arguments_json str
destination str

The destination queue or exchange.

destination_type str

The type of destination (queue or exchange).

properties_key str

A unique key to refer to the binding.

routing_key str

A routing key for the binding.

source str

The source exchange.

vhost str

The vhost to create the resource in.

arguments Map<Any>

Additional key/value arguments for the binding.

argumentsJson String
destination String

The destination queue or exchange.

destinationType String

The type of destination (queue or exchange).

propertiesKey String

A unique key to refer to the binding.

routingKey String

A routing key for the binding.

source String

The source exchange.

vhost String

The vhost to create the resource in.

Import

Bindings can be imported using the id which is composed of

vhost/source/destination/destination_type/properties_key. E.g.

 $ pulumi import rabbitmq:index/binding:Binding test test/test/test/queue/%23

Package Details

Repository
RabbitMQ pulumi/pulumi-rabbitmq
License
Apache-2.0
Notes

This Pulumi package is based on the rabbitmq Terraform Provider.