1. Packages
  2. Redpanda Provider
  3. API Docs
  4. RoleAssignment
redpanda 1.3.4 published on Monday, Nov 3, 2025 by redpanda-data

redpanda.RoleAssignment

Start a Neo task
Explain and create a redpanda.RoleAssignment resource
redpanda logo
redpanda 1.3.4 published on Monday, Nov 3, 2025 by redpanda-data

    Assigns an existing Redpanda role to a principal. Resource ID format: {role_name}:{principal}

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as redpanda from "@pulumi/redpanda";
    
    const exampleResourceGroup = new redpanda.ResourceGroup("exampleResourceGroup", {});
    const exampleNetwork = new redpanda.Network("exampleNetwork", {
        resourceGroupId: exampleResourceGroup.id,
        cloudProvider: "aws",
        region: "us-west-2",
        clusterType: "dedicated",
        cidrBlock: "10.0.0.0/20",
    });
    const exampleCluster = new redpanda.Cluster("exampleCluster", {
        resourceGroupId: exampleResourceGroup.id,
        networkId: exampleNetwork.id,
        cloudProvider: "aws",
        region: "us-west-2",
        clusterType: "dedicated",
        connectionType: "public",
        throughputTier: "tier-1-aws",
        zones: [
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        ],
    });
    const exampleUser = new redpanda.User("exampleUser", {
        password: "secure-password-123",
        mechanism: "scram-sha-256",
        clusterApiUrl: exampleCluster.clusterApiUrl,
        allowDeletion: true,
    });
    const exampleRoleAssignment = new redpanda.RoleAssignment("exampleRoleAssignment", {
        roleName: "test-role",
        principal: exampleUser.name,
        clusterApiUrl: exampleCluster.clusterApiUrl,
    });
    
    import pulumi
    import pulumi_redpanda as redpanda
    
    example_resource_group = redpanda.ResourceGroup("exampleResourceGroup")
    example_network = redpanda.Network("exampleNetwork",
        resource_group_id=example_resource_group.id,
        cloud_provider="aws",
        region="us-west-2",
        cluster_type="dedicated",
        cidr_block="10.0.0.0/20")
    example_cluster = redpanda.Cluster("exampleCluster",
        resource_group_id=example_resource_group.id,
        network_id=example_network.id,
        cloud_provider="aws",
        region="us-west-2",
        cluster_type="dedicated",
        connection_type="public",
        throughput_tier="tier-1-aws",
        zones=[
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        ])
    example_user = redpanda.User("exampleUser",
        password="secure-password-123",
        mechanism="scram-sha-256",
        cluster_api_url=example_cluster.cluster_api_url,
        allow_deletion=True)
    example_role_assignment = redpanda.RoleAssignment("exampleRoleAssignment",
        role_name="test-role",
        principal=example_user.name,
        cluster_api_url=example_cluster.cluster_api_url)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/redpanda/redpanda"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := redpanda.NewResourceGroup(ctx, "exampleResourceGroup", nil)
    		if err != nil {
    			return err
    		}
    		exampleNetwork, err := redpanda.NewNetwork(ctx, "exampleNetwork", &redpanda.NetworkArgs{
    			ResourceGroupId: exampleResourceGroup.ID(),
    			CloudProvider:   pulumi.String("aws"),
    			Region:          pulumi.String("us-west-2"),
    			ClusterType:     pulumi.String("dedicated"),
    			CidrBlock:       pulumi.String("10.0.0.0/20"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleCluster, err := redpanda.NewCluster(ctx, "exampleCluster", &redpanda.ClusterArgs{
    			ResourceGroupId: exampleResourceGroup.ID(),
    			NetworkId:       exampleNetwork.ID(),
    			CloudProvider:   pulumi.String("aws"),
    			Region:          pulumi.String("us-west-2"),
    			ClusterType:     pulumi.String("dedicated"),
    			ConnectionType:  pulumi.String("public"),
    			ThroughputTier:  pulumi.String("tier-1-aws"),
    			Zones: pulumi.StringArray{
    				pulumi.String("us-west-2a"),
    				pulumi.String("us-west-2b"),
    				pulumi.String("us-west-2c"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleUser, err := redpanda.NewUser(ctx, "exampleUser", &redpanda.UserArgs{
    			Password:      pulumi.String("secure-password-123"),
    			Mechanism:     pulumi.String("scram-sha-256"),
    			ClusterApiUrl: exampleCluster.ClusterApiUrl,
    			AllowDeletion: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = redpanda.NewRoleAssignment(ctx, "exampleRoleAssignment", &redpanda.RoleAssignmentArgs{
    			RoleName:      pulumi.String("test-role"),
    			Principal:     exampleUser.Name,
    			ClusterApiUrl: exampleCluster.ClusterApiUrl,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Redpanda = Pulumi.Redpanda;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Redpanda.ResourceGroup("exampleResourceGroup");
    
        var exampleNetwork = new Redpanda.Network("exampleNetwork", new()
        {
            ResourceGroupId = exampleResourceGroup.Id,
            CloudProvider = "aws",
            Region = "us-west-2",
            ClusterType = "dedicated",
            CidrBlock = "10.0.0.0/20",
        });
    
        var exampleCluster = new Redpanda.Cluster("exampleCluster", new()
        {
            ResourceGroupId = exampleResourceGroup.Id,
            NetworkId = exampleNetwork.Id,
            CloudProvider = "aws",
            Region = "us-west-2",
            ClusterType = "dedicated",
            ConnectionType = "public",
            ThroughputTier = "tier-1-aws",
            Zones = new[]
            {
                "us-west-2a",
                "us-west-2b",
                "us-west-2c",
            },
        });
    
        var exampleUser = new Redpanda.User("exampleUser", new()
        {
            Password = "secure-password-123",
            Mechanism = "scram-sha-256",
            ClusterApiUrl = exampleCluster.ClusterApiUrl,
            AllowDeletion = true,
        });
    
        var exampleRoleAssignment = new Redpanda.RoleAssignment("exampleRoleAssignment", new()
        {
            RoleName = "test-role",
            Principal = exampleUser.Name,
            ClusterApiUrl = exampleCluster.ClusterApiUrl,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.redpanda.ResourceGroup;
    import com.pulumi.redpanda.Network;
    import com.pulumi.redpanda.NetworkArgs;
    import com.pulumi.redpanda.Cluster;
    import com.pulumi.redpanda.ClusterArgs;
    import com.pulumi.redpanda.User;
    import com.pulumi.redpanda.UserArgs;
    import com.pulumi.redpanda.RoleAssignment;
    import com.pulumi.redpanda.RoleAssignmentArgs;
    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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup");
    
            var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
                .resourceGroupId(exampleResourceGroup.id())
                .cloudProvider("aws")
                .region("us-west-2")
                .clusterType("dedicated")
                .cidrBlock("10.0.0.0/20")
                .build());
    
            var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()
                .resourceGroupId(exampleResourceGroup.id())
                .networkId(exampleNetwork.id())
                .cloudProvider("aws")
                .region("us-west-2")
                .clusterType("dedicated")
                .connectionType("public")
                .throughputTier("tier-1-aws")
                .zones(            
                    "us-west-2a",
                    "us-west-2b",
                    "us-west-2c")
                .build());
    
            var exampleUser = new User("exampleUser", UserArgs.builder()
                .password("secure-password-123")
                .mechanism("scram-sha-256")
                .clusterApiUrl(exampleCluster.clusterApiUrl())
                .allowDeletion(true)
                .build());
    
            var exampleRoleAssignment = new RoleAssignment("exampleRoleAssignment", RoleAssignmentArgs.builder()
                .roleName("test-role")
                .principal(exampleUser.name())
                .clusterApiUrl(exampleCluster.clusterApiUrl())
                .build());
    
        }
    }
    
    resources:
      exampleResourceGroup:
        type: redpanda:ResourceGroup
      exampleNetwork:
        type: redpanda:Network
        properties:
          resourceGroupId: ${exampleResourceGroup.id}
          cloudProvider: aws
          region: us-west-2
          clusterType: dedicated
          cidrBlock: 10.0.0.0/20
      exampleCluster:
        type: redpanda:Cluster
        properties:
          resourceGroupId: ${exampleResourceGroup.id}
          networkId: ${exampleNetwork.id}
          cloudProvider: aws
          region: us-west-2
          clusterType: dedicated
          connectionType: public
          throughputTier: tier-1-aws
          zones:
            - us-west-2a
            - us-west-2b
            - us-west-2c
      exampleUser:
        type: redpanda:User
        properties:
          password: secure-password-123
          mechanism: scram-sha-256
          clusterApiUrl: ${exampleCluster.clusterApiUrl}
          allowDeletion: true
      exampleRoleAssignment:
        type: redpanda:RoleAssignment
        properties:
          roleName: test-role
          principal: ${exampleUser.name}
          clusterApiUrl: ${exampleCluster.clusterApiUrl}
    

    Notes

    • The role must already exist before it can be assigned. Roles are typically created using rpk security role create or through the Redpanda Console.
    • The principal should be specified as just the username (e.g., "john.doe"). The User: prefix is not needed and will be automatically stripped if provided.
    • Role assignments are atomic operations - you cannot update an existing assignment. To change a role assignment, delete and recreate the resource.
    • The resource uses the Redpanda gRPC SecurityService (via console endpoint) for role management operations.

    API Reference

    For more information, see the Redpanda Cloud Data Plane API documentation.

    Create RoleAssignment Resource

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

    Constructor syntax

    new RoleAssignment(name: string, args: RoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def RoleAssignment(resource_name: str,
                       args: RoleAssignmentArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def RoleAssignment(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       cluster_api_url: Optional[str] = None,
                       principal: Optional[str] = None,
                       role_name: Optional[str] = None)
    func NewRoleAssignment(ctx *Context, name string, args RoleAssignmentArgs, opts ...ResourceOption) (*RoleAssignment, error)
    public RoleAssignment(string name, RoleAssignmentArgs args, CustomResourceOptions? opts = null)
    public RoleAssignment(String name, RoleAssignmentArgs args)
    public RoleAssignment(String name, RoleAssignmentArgs args, CustomResourceOptions options)
    
    type: redpanda:RoleAssignment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RoleAssignmentArgs
    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 RoleAssignmentArgs
    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 RoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleAssignmentArgs
    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 roleAssignmentResource = new Redpanda.RoleAssignment("roleAssignmentResource", new()
    {
        ClusterApiUrl = "string",
        Principal = "string",
        RoleName = "string",
    });
    
    example, err := redpanda.NewRoleAssignment(ctx, "roleAssignmentResource", &redpanda.RoleAssignmentArgs{
    	ClusterApiUrl: pulumi.String("string"),
    	Principal:     pulumi.String("string"),
    	RoleName:      pulumi.String("string"),
    })
    
    var roleAssignmentResource = new RoleAssignment("roleAssignmentResource", RoleAssignmentArgs.builder()
        .clusterApiUrl("string")
        .principal("string")
        .roleName("string")
        .build());
    
    role_assignment_resource = redpanda.RoleAssignment("roleAssignmentResource",
        cluster_api_url="string",
        principal="string",
        role_name="string")
    
    const roleAssignmentResource = new redpanda.RoleAssignment("roleAssignmentResource", {
        clusterApiUrl: "string",
        principal: "string",
        roleName: "string",
    });
    
    type: redpanda:RoleAssignment
    properties:
        clusterApiUrl: string
        principal: string
        roleName: string
    

    RoleAssignment 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 RoleAssignment resource accepts the following input properties:

    ClusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    Principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    RoleName string
    The name of the role to assign
    ClusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    Principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    RoleName string
    The name of the role to assign
    clusterApiUrl String
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal String
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName String
    The name of the role to assign
    clusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName string
    The name of the role to assign
    cluster_api_url str
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal str
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    role_name str
    The name of the role to assign
    clusterApiUrl String
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal String
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName String
    The name of the role to assign

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RoleAssignment 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 RoleAssignment Resource

    Get an existing RoleAssignment 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?: RoleAssignmentState, opts?: CustomResourceOptions): RoleAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_api_url: Optional[str] = None,
            principal: Optional[str] = None,
            role_name: Optional[str] = None) -> RoleAssignment
    func GetRoleAssignment(ctx *Context, name string, id IDInput, state *RoleAssignmentState, opts ...ResourceOption) (*RoleAssignment, error)
    public static RoleAssignment Get(string name, Input<string> id, RoleAssignmentState? state, CustomResourceOptions? opts = null)
    public static RoleAssignment get(String name, Output<String> id, RoleAssignmentState state, CustomResourceOptions options)
    resources:  _:    type: redpanda:RoleAssignment    get:      id: ${id}
    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:
    ClusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    Principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    RoleName string
    The name of the role to assign
    ClusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    Principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    RoleName string
    The name of the role to assign
    clusterApiUrl String
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal String
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName String
    The name of the role to assign
    clusterApiUrl string
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal string
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName string
    The name of the role to assign
    cluster_api_url str
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal str
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    role_name str
    The name of the role to assign
    clusterApiUrl String
    The cluster API URL. Changing this will prevent deletion of the resource on the existing cluster
    principal String
    The principal to assign the role to. Specify just the username (e.g., "john.doe")
    roleName String
    The name of the role to assign

    Import

    Role assignments can be imported using the format role_name:principal:

    $ pulumi import redpanda:index/roleAssignment:RoleAssignment test "test-role:test-user"
    

    Note: The cluster_api_url must be specified in your Terraform configuration. The import will validate the role assignment exists during the next pulumi preview or pulumi up.

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

    Package Details

    Repository
    redpanda redpanda-data/terraform-provider-redpanda
    License
    Notes
    This Pulumi package is based on the redpanda Terraform Provider.
    redpanda logo
    redpanda 1.3.4 published on Monday, Nov 3, 2025 by redpanda-data
      Meet Neo: Your AI Platform Teammate