Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Binding

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

Example Usage

using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;

class MyStack : Stack
{
    public MyStack()
    {
        var testVHost = new RabbitMQ.VHost("testVHost", new RabbitMQ.VHostArgs
        {
        });
        var guest = new RabbitMQ.Permissions("guest", new RabbitMQ.PermissionsArgs
        {
            Permissions = new RabbitMQ.Inputs.PermissionsPermissionsArgs
            {
                Configure = ".*",
                Read = ".*",
                Write = ".*",
            },
            User = "guest",
            Vhost = testVHost.Name,
        });
        var testExchange = new RabbitMQ.Exchange("testExchange", new RabbitMQ.ExchangeArgs
        {
            Settings = new RabbitMQ.Inputs.ExchangeSettingsArgs
            {
                AutoDelete = true,
                Durable = false,
                Type = "fanout",
            },
            Vhost = guest.Vhost,
        });
        var testQueue = new RabbitMQ.Queue("testQueue", new RabbitMQ.QueueArgs
        {
            Settings = new RabbitMQ.Inputs.QueueSettingsArgs
            {
                AutoDelete = false,
                Durable = true,
            },
            Vhost = guest.Vhost,
        });
        var testBinding = new RabbitMQ.Binding("testBinding", new RabbitMQ.BindingArgs
        {
            Destination = testQueue.Name,
            DestinationType = "queue",
            RoutingKey = "#",
            Source = testExchange.Name,
            Vhost = testVHost.Name,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-rabbitmq/sdk/v2/go/rabbitmq"
    "github.com/pulumi/pulumi/sdk/v2/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
    })
}
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("test", {});
const guest = new rabbitmq.Permissions("guest", {
    permissions: {
        configure: ".*",
        read: ".*",
        write: ".*",
    },
    user: "guest",
    vhost: testVHost.name,
});
const testExchange = new rabbitmq.Exchange("test", {
    settings: {
        autoDelete: true,
        durable: false,
        type: "fanout",
    },
    vhost: guest.vhost,
});
const testQueue = new rabbitmq.Queue("test", {
    settings: {
        autoDelete: false,
        durable: true,
    },
    vhost: guest.vhost,
});
const testBinding = new rabbitmq.Binding("test", {
    destination: testQueue.name,
    destinationType: "queue",
    routingKey: "#",
    source: testExchange.name,
    vhost: testVHost.name,
});

Create a Binding Resource

new Binding(name: string, args: BindingArgs, opts?: CustomResourceOptions);
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)
func NewBinding(ctx *Context, name string, args BindingArgs, opts ...ResourceOption) (*Binding, error)
public Binding(string name, BindingArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Binding Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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 {[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.

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 str
The provider-assigned unique ID for this managed resource.
properties_key str

A unique key to refer to the binding.

Look up an 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)
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.

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 {[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.

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
https://github.com/pulumi/pulumi-rabbitmq
License
Apache-2.0
Notes
This Pulumi package is based on the rabbitmq Terraform Provider.