1. Packages
  2. Rabbitmq Provider
  3. API Docs
  4. TopicPermissions
RabbitMQ v3.3.9 published on Wednesday, Feb 12, 2025 by Pulumi

rabbitmq.TopicPermissions

Explore with Pulumi AI

The rabbitmq.TopicPermissions resource creates and manages a user’s set of topic permissions.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as rabbitmq from "@pulumi/rabbitmq";

const test = new rabbitmq.VHost("test", {name: "test"});
const testUser = new rabbitmq.User("test", {
    name: "mctest",
    password: "foobar",
    tags: ["administrator"],
});
const testTopicPermissions = new rabbitmq.TopicPermissions("test", {
    user: testUser.name,
    vhost: test.name,
    permissions: [{
        exchange: "amq.topic",
        write: ".*",
        read: ".*",
    }],
});
Copy
import pulumi
import pulumi_rabbitmq as rabbitmq

test = rabbitmq.VHost("test", name="test")
test_user = rabbitmq.User("test",
    name="mctest",
    password="foobar",
    tags=["administrator"])
test_topic_permissions = rabbitmq.TopicPermissions("test",
    user=test_user.name,
    vhost=test.name,
    permissions=[{
        "exchange": "amq.topic",
        "write": ".*",
        "read": ".*",
    }])
Copy
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 {
		test, err := rabbitmq.NewVHost(ctx, "test", &rabbitmq.VHostArgs{
			Name: pulumi.String("test"),
		})
		if err != nil {
			return err
		}
		testUser, err := rabbitmq.NewUser(ctx, "test", &rabbitmq.UserArgs{
			Name:     pulumi.String("mctest"),
			Password: pulumi.String("foobar"),
			Tags: pulumi.StringArray{
				pulumi.String("administrator"),
			},
		})
		if err != nil {
			return err
		}
		_, err = rabbitmq.NewTopicPermissions(ctx, "test", &rabbitmq.TopicPermissionsArgs{
			User:  testUser.Name,
			Vhost: test.Name,
			Permissions: rabbitmq.TopicPermissionsPermissionArray{
				&rabbitmq.TopicPermissionsPermissionArgs{
					Exchange: pulumi.String("amq.topic"),
					Write:    pulumi.String(".*"),
					Read:     pulumi.String(".*"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using RabbitMQ = Pulumi.RabbitMQ;

return await Deployment.RunAsync(() => 
{
    var test = new RabbitMQ.VHost("test", new()
    {
        Name = "test",
    });

    var testUser = new RabbitMQ.User("test", new()
    {
        Name = "mctest",
        Password = "foobar",
        Tags = new[]
        {
            "administrator",
        },
    });

    var testTopicPermissions = new RabbitMQ.TopicPermissions("test", new()
    {
        User = testUser.Name,
        Vhost = test.Name,
        Permissions = new[]
        {
            new RabbitMQ.Inputs.TopicPermissionsPermissionArgs
            {
                Exchange = "amq.topic",
                Write = ".*",
                Read = ".*",
            },
        },
    });

});
Copy
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.VHostArgs;
import com.pulumi.rabbitmq.User;
import com.pulumi.rabbitmq.UserArgs;
import com.pulumi.rabbitmq.TopicPermissions;
import com.pulumi.rabbitmq.TopicPermissionsArgs;
import com.pulumi.rabbitmq.inputs.TopicPermissionsPermissionArgs;
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 test = new VHost("test", VHostArgs.builder()
            .name("test")
            .build());

        var testUser = new User("testUser", UserArgs.builder()
            .name("mctest")
            .password("foobar")
            .tags("administrator")
            .build());

        var testTopicPermissions = new TopicPermissions("testTopicPermissions", TopicPermissionsArgs.builder()
            .user(testUser.name())
            .vhost(test.name())
            .permissions(TopicPermissionsPermissionArgs.builder()
                .exchange("amq.topic")
                .write(".*")
                .read(".*")
                .build())
            .build());

    }
}
Copy
resources:
  test:
    type: rabbitmq:VHost
    properties:
      name: test
  testUser:
    type: rabbitmq:User
    name: test
    properties:
      name: mctest
      password: foobar
      tags:
        - administrator
  testTopicPermissions:
    type: rabbitmq:TopicPermissions
    name: test
    properties:
      user: ${testUser.name}
      vhost: ${test.name}
      permissions:
        - exchange: amq.topic
          write: .*
          read: .*
Copy

Create TopicPermissions Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new TopicPermissions(name: string, args: TopicPermissionsArgs, opts?: CustomResourceOptions);
@overload
def TopicPermissions(resource_name: str,
                     args: TopicPermissionsArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def TopicPermissions(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     permissions: Optional[Sequence[TopicPermissionsPermissionArgs]] = None,
                     user: Optional[str] = None,
                     vhost: Optional[str] = None)
func NewTopicPermissions(ctx *Context, name string, args TopicPermissionsArgs, opts ...ResourceOption) (*TopicPermissions, error)
public TopicPermissions(string name, TopicPermissionsArgs args, CustomResourceOptions? opts = null)
public TopicPermissions(String name, TopicPermissionsArgs args)
public TopicPermissions(String name, TopicPermissionsArgs args, CustomResourceOptions options)
type: rabbitmq:TopicPermissions
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

The following reference example uses placeholder values for all input properties.

var topicPermissionsResource = new RabbitMQ.TopicPermissions("topicPermissionsResource", new()
{
    Permissions = new[]
    {
        new RabbitMQ.Inputs.TopicPermissionsPermissionArgs
        {
            Exchange = "string",
            Read = "string",
            Write = "string",
        },
    },
    User = "string",
    Vhost = "string",
});
Copy
example, err := rabbitmq.NewTopicPermissions(ctx, "topicPermissionsResource", &rabbitmq.TopicPermissionsArgs{
	Permissions: rabbitmq.TopicPermissionsPermissionArray{
		&rabbitmq.TopicPermissionsPermissionArgs{
			Exchange: pulumi.String("string"),
			Read:     pulumi.String("string"),
			Write:    pulumi.String("string"),
		},
	},
	User:  pulumi.String("string"),
	Vhost: pulumi.String("string"),
})
Copy
var topicPermissionsResource = new TopicPermissions("topicPermissionsResource", TopicPermissionsArgs.builder()
    .permissions(TopicPermissionsPermissionArgs.builder()
        .exchange("string")
        .read("string")
        .write("string")
        .build())
    .user("string")
    .vhost("string")
    .build());
Copy
topic_permissions_resource = rabbitmq.TopicPermissions("topicPermissionsResource",
    permissions=[{
        "exchange": "string",
        "read": "string",
        "write": "string",
    }],
    user="string",
    vhost="string")
Copy
const topicPermissionsResource = new rabbitmq.TopicPermissions("topicPermissionsResource", {
    permissions: [{
        exchange: "string",
        read: "string",
        write: "string",
    }],
    user: "string",
    vhost: "string",
});
Copy
type: rabbitmq:TopicPermissions
properties:
    permissions:
        - exchange: string
          read: string
          write: string
    user: string
    vhost: string
Copy

TopicPermissions Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The TopicPermissions resource accepts the following input properties:

Permissions This property is required. List<Pulumi.RabbitMQ.Inputs.TopicPermissionsPermission>
The settings of the permissions. The structure is described below.
User
This property is required.
Changes to this property will trigger replacement.
string
The user to apply the permissions to.
Vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
Permissions This property is required. []TopicPermissionsPermissionArgs
The settings of the permissions. The structure is described below.
User
This property is required.
Changes to this property will trigger replacement.
string
The user to apply the permissions to.
Vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
permissions This property is required. List<TopicPermissionsPermission>
The settings of the permissions. The structure is described below.
user
This property is required.
Changes to this property will trigger replacement.
String
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. String
The vhost to create the resource in.
permissions This property is required. TopicPermissionsPermission[]
The settings of the permissions. The structure is described below.
user
This property is required.
Changes to this property will trigger replacement.
string
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
permissions This property is required. Sequence[TopicPermissionsPermissionArgs]
The settings of the permissions. The structure is described below.
user
This property is required.
Changes to this property will trigger replacement.
str
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. str
The vhost to create the resource in.
permissions This property is required. List<Property Map>
The settings of the permissions. The structure is described below.
user
This property is required.
Changes to this property will trigger replacement.
String
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. String
The vhost to create the resource in.

Outputs

All input properties are implicitly available as output properties. Additionally, the TopicPermissions 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 string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing TopicPermissions Resource

Get an existing TopicPermissions 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?: TopicPermissionsState, opts?: CustomResourceOptions): TopicPermissions
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        permissions: Optional[Sequence[TopicPermissionsPermissionArgs]] = None,
        user: Optional[str] = None,
        vhost: Optional[str] = None) -> TopicPermissions
func GetTopicPermissions(ctx *Context, name string, id IDInput, state *TopicPermissionsState, opts ...ResourceOption) (*TopicPermissions, error)
public static TopicPermissions Get(string name, Input<string> id, TopicPermissionsState? state, CustomResourceOptions? opts = null)
public static TopicPermissions get(String name, Output<String> id, TopicPermissionsState state, CustomResourceOptions options)
resources:  _:    type: rabbitmq:TopicPermissions    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Permissions List<Pulumi.RabbitMQ.Inputs.TopicPermissionsPermission>
The settings of the permissions. The structure is described below.
User Changes to this property will trigger replacement. string
The user to apply the permissions to.
Vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
Permissions []TopicPermissionsPermissionArgs
The settings of the permissions. The structure is described below.
User Changes to this property will trigger replacement. string
The user to apply the permissions to.
Vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
permissions List<TopicPermissionsPermission>
The settings of the permissions. The structure is described below.
user Changes to this property will trigger replacement. String
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. String
The vhost to create the resource in.
permissions TopicPermissionsPermission[]
The settings of the permissions. The structure is described below.
user Changes to this property will trigger replacement. string
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. string
The vhost to create the resource in.
permissions Sequence[TopicPermissionsPermissionArgs]
The settings of the permissions. The structure is described below.
user Changes to this property will trigger replacement. str
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. str
The vhost to create the resource in.
permissions List<Property Map>
The settings of the permissions. The structure is described below.
user Changes to this property will trigger replacement. String
The user to apply the permissions to.
vhost Changes to this property will trigger replacement. String
The vhost to create the resource in.

Supporting Types

TopicPermissionsPermission
, TopicPermissionsPermissionArgs

Exchange This property is required. string
The exchange to set the permissions for.
Read This property is required. string
The "read" ACL.
Write This property is required. string
The "write" ACL.
Exchange This property is required. string
The exchange to set the permissions for.
Read This property is required. string
The "read" ACL.
Write This property is required. string
The "write" ACL.
exchange This property is required. String
The exchange to set the permissions for.
read This property is required. String
The "read" ACL.
write This property is required. String
The "write" ACL.
exchange This property is required. string
The exchange to set the permissions for.
read This property is required. string
The "read" ACL.
write This property is required. string
The "write" ACL.
exchange This property is required. str
The exchange to set the permissions for.
read This property is required. str
The "read" ACL.
write This property is required. str
The "write" ACL.
exchange This property is required. String
The exchange to set the permissions for.
read This property is required. String
The "read" ACL.
write This property is required. String
The "write" ACL.

Import

Permissions can be imported using the id which is composed of user@vhost.

E.g.

$ pulumi import rabbitmq:index/topicPermissions:TopicPermissions test user@vhost
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
RabbitMQ pulumi/pulumi-rabbitmq
License
Apache-2.0
Notes
This Pulumi package is based on the rabbitmq Terraform Provider.