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

Exchange

The rabbitmq.Exchange resource creates and manages 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,
        });
    }

}
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
        }
        _, 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
        }
        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)
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,
});

Create a Exchange Resource

new Exchange(name: string, args: ExchangeArgs, opts?: CustomResourceOptions);
def Exchange(resource_name: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, settings: Optional[ExchangeSettingsArgs] = None, vhost: Optional[str] = None)
func NewExchange(ctx *Context, name string, args ExchangeArgs, opts ...ResourceOption) (*Exchange, error)
public Exchange(string name, ExchangeArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ExchangeArgs
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 ExchangeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ExchangeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Exchange Resource Properties

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

Inputs

The Exchange resource accepts the following input properties:

Settings Pulumi.RabbitMQ.Inputs.ExchangeSettingsArgs

The settings of the exchange. The structure is described below.

Name string

The name of the exchange.

Vhost string

The vhost to create the resource in.

Settings ExchangeSettings

The settings of the exchange. The structure is described below.

Name string

The name of the exchange.

Vhost string

The vhost to create the resource in.

settings ExchangeSettings

The settings of the exchange. The structure is described below.

name string

The name of the exchange.

vhost string

The vhost to create the resource in.

settings ExchangeSettingsArgs

The settings of the exchange. The structure is described below.

name str

The name of the exchange.

vhost str

The vhost to create the resource in.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Exchange Resource

Get an existing Exchange 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?: ExchangeState, opts?: CustomResourceOptions): Exchange
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, name: Optional[str] = None, settings: Optional[ExchangeSettingsArgs] = None, vhost: Optional[str] = None) -> Exchange
func GetExchange(ctx *Context, name string, id IDInput, state *ExchangeState, opts ...ResourceOption) (*Exchange, error)
public static Exchange Get(string name, Input<string> id, ExchangeState? 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:

Name string

The name of the exchange.

Settings Pulumi.RabbitMQ.Inputs.ExchangeSettingsArgs

The settings of the exchange. The structure is described below.

Vhost string

The vhost to create the resource in.

Name string

The name of the exchange.

Settings ExchangeSettings

The settings of the exchange. The structure is described below.

Vhost string

The vhost to create the resource in.

name string

The name of the exchange.

settings ExchangeSettings

The settings of the exchange. The structure is described below.

vhost string

The vhost to create the resource in.

name str

The name of the exchange.

settings ExchangeSettingsArgs

The settings of the exchange. The structure is described below.

vhost str

The vhost to create the resource in.

Supporting Types

ExchangeSettings

Type string

The type of exchange.

Arguments Dictionary<string, object>

Additional key/value settings for the exchange.

AutoDelete bool

Whether the exchange will self-delete when all queues have finished using it.

Durable bool

Whether the exchange survives server restarts. Defaults to false.

Type string

The type of exchange.

Arguments map[string]interface{}

Additional key/value settings for the exchange.

AutoDelete bool

Whether the exchange will self-delete when all queues have finished using it.

Durable bool

Whether the exchange survives server restarts. Defaults to false.

type string

The type of exchange.

arguments {[key: string]: any}

Additional key/value settings for the exchange.

autoDelete boolean

Whether the exchange will self-delete when all queues have finished using it.

durable boolean

Whether the exchange survives server restarts. Defaults to false.

type str

The type of exchange.

arguments Mapping[str, Any]

Additional key/value settings for the exchange.

auto_delete bool

Whether the exchange will self-delete when all queues have finished using it.

durable bool

Whether the exchange survives server restarts. Defaults to false.

Import

Exchanges can be imported using the id which is composed of

name@vhost. E.g.

 $ pulumi import rabbitmq:index/exchange:Exchange test test@vhost

Package Details

Repository
https://github.com/pulumi/pulumi-rabbitmq
License
Apache-2.0
Notes
This Pulumi package is based on the rabbitmq Terraform Provider.