1. Packages
  2. OpenStack
  3. API Docs
  4. identity
  5. RoleAssignment
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

openstack.identity.RoleAssignment

Explore with Pulumi AI

openstack logo
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

    Manages a V3 Role assignment within OpenStack Keystone.

    Note: You must have admin privileges in your OpenStack cloud to use this resource.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var project1 = new OpenStack.Identity.Project("project1");
    
        var user1 = new OpenStack.Identity.User("user1", new()
        {
            DefaultProjectId = project1.Id,
        });
    
        var role1 = new OpenStack.Identity.Role("role1");
    
        var roleAssignment1 = new OpenStack.Identity.RoleAssignment("roleAssignment1", new()
        {
            UserId = user1.Id,
            ProjectId = project1.Id,
            RoleId = role1.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		project1, err := identity.NewProject(ctx, "project1", nil)
    		if err != nil {
    			return err
    		}
    		user1, err := identity.NewUser(ctx, "user1", &identity.UserArgs{
    			DefaultProjectId: project1.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		role1, err := identity.NewRole(ctx, "role1", nil)
    		if err != nil {
    			return err
    		}
    		_, err = identity.NewRoleAssignment(ctx, "roleAssignment1", &identity.RoleAssignmentArgs{
    			UserId:    user1.ID(),
    			ProjectId: project1.ID(),
    			RoleId:    role1.ID(),
    		})
    		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.openstack.identity.Project;
    import com.pulumi.openstack.identity.User;
    import com.pulumi.openstack.identity.UserArgs;
    import com.pulumi.openstack.identity.Role;
    import com.pulumi.openstack.identity.RoleAssignment;
    import com.pulumi.openstack.identity.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 project1 = new Project("project1");
    
            var user1 = new User("user1", UserArgs.builder()        
                .defaultProjectId(project1.id())
                .build());
    
            var role1 = new Role("role1");
    
            var roleAssignment1 = new RoleAssignment("roleAssignment1", RoleAssignmentArgs.builder()        
                .userId(user1.id())
                .projectId(project1.id())
                .roleId(role1.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_openstack as openstack
    
    project1 = openstack.identity.Project("project1")
    user1 = openstack.identity.User("user1", default_project_id=project1.id)
    role1 = openstack.identity.Role("role1")
    role_assignment1 = openstack.identity.RoleAssignment("roleAssignment1",
        user_id=user1.id,
        project_id=project1.id,
        role_id=role1.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const project1 = new openstack.identity.Project("project1", {});
    const user1 = new openstack.identity.User("user1", {defaultProjectId: project1.id});
    const role1 = new openstack.identity.Role("role1", {});
    const roleAssignment1 = new openstack.identity.RoleAssignment("roleAssignment1", {
        userId: user1.id,
        projectId: project1.id,
        roleId: role1.id,
    });
    
    resources:
      project1:
        type: openstack:identity:Project
      user1:
        type: openstack:identity:User
        properties:
          defaultProjectId: ${project1.id}
      role1:
        type: openstack:identity:Role
      roleAssignment1:
        type: openstack:identity:RoleAssignment
        properties:
          userId: ${user1.id}
          projectId: ${project1.id}
          roleId: ${role1.id}
    

    Create RoleAssignment Resource

    new RoleAssignment(name: string, args: RoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def RoleAssignment(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       domain_id: Optional[str] = None,
                       group_id: Optional[str] = None,
                       project_id: Optional[str] = None,
                       region: Optional[str] = None,
                       role_id: Optional[str] = None,
                       user_id: Optional[str] = None)
    @overload
    def RoleAssignment(resource_name: str,
                       args: RoleAssignmentArgs,
                       opts: Optional[ResourceOptions] = 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: openstack:identity:RoleAssignment
    properties: # The arguments to resource properties.
    options: # 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.
    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.

    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

    The RoleAssignment resource accepts the following input properties:

    RoleId string
    The role to assign.
    DomainId string
    The domain to assign the role in.
    GroupId string
    The group to assign the role to.
    ProjectId string
    The project to assign the role in.
    Region string
    UserId string
    The user to assign the role to.
    RoleId string
    The role to assign.
    DomainId string
    The domain to assign the role in.
    GroupId string
    The group to assign the role to.
    ProjectId string
    The project to assign the role in.
    Region string
    UserId string
    The user to assign the role to.
    roleId String
    The role to assign.
    domainId String
    The domain to assign the role in.
    groupId String
    The group to assign the role to.
    projectId String
    The project to assign the role in.
    region String
    userId String
    The user to assign the role to.
    roleId string
    The role to assign.
    domainId string
    The domain to assign the role in.
    groupId string
    The group to assign the role to.
    projectId string
    The project to assign the role in.
    region string
    userId string
    The user to assign the role to.
    role_id str
    The role to assign.
    domain_id str
    The domain to assign the role in.
    group_id str
    The group to assign the role to.
    project_id str
    The project to assign the role in.
    region str
    user_id str
    The user to assign the role to.
    roleId String
    The role to assign.
    domainId String
    The domain to assign the role in.
    groupId String
    The group to assign the role to.
    projectId String
    The project to assign the role in.
    region String
    userId String
    The user to assign the role to.

    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,
            domain_id: Optional[str] = None,
            group_id: Optional[str] = None,
            project_id: Optional[str] = None,
            region: Optional[str] = None,
            role_id: Optional[str] = None,
            user_id: 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)
    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:
    DomainId string
    The domain to assign the role in.
    GroupId string
    The group to assign the role to.
    ProjectId string
    The project to assign the role in.
    Region string
    RoleId string
    The role to assign.
    UserId string
    The user to assign the role to.
    DomainId string
    The domain to assign the role in.
    GroupId string
    The group to assign the role to.
    ProjectId string
    The project to assign the role in.
    Region string
    RoleId string
    The role to assign.
    UserId string
    The user to assign the role to.
    domainId String
    The domain to assign the role in.
    groupId String
    The group to assign the role to.
    projectId String
    The project to assign the role in.
    region String
    roleId String
    The role to assign.
    userId String
    The user to assign the role to.
    domainId string
    The domain to assign the role in.
    groupId string
    The group to assign the role to.
    projectId string
    The project to assign the role in.
    region string
    roleId string
    The role to assign.
    userId string
    The user to assign the role to.
    domain_id str
    The domain to assign the role in.
    group_id str
    The group to assign the role to.
    project_id str
    The project to assign the role in.
    region str
    role_id str
    The role to assign.
    user_id str
    The user to assign the role to.
    domainId String
    The domain to assign the role in.
    groupId String
    The group to assign the role to.
    projectId String
    The project to assign the role in.
    region String
    roleId String
    The role to assign.
    userId String
    The user to assign the role to.

    Import

    Role assignments can be imported using a constructed id. The id should have the form of domainID/projectID/groupID/userID/roleID. When something is not used then leave blank.

    For example this will import the role assignment forprojectID014395cd-89fc-4c9b-96b7-13d1ee79dad2, userID4142e64b-1b35-44a0-9b1e-5affc7af1106, roleIDea257959-eeb1-4c10-8d33-26f0409a755d ( domainID and groupID are left blank)

     $ pulumi import openstack:identity/roleAssignment:RoleAssignment role_assignment_1 /014395cd-89fc-4c9b-96b7-13d1ee79dad2//4142e64b-1b35-44a0-9b1e-5affc7af1106/ea257959-eeb1-4c10-8d33-26f0409a755d
    

    Package Details

    Repository
    OpenStack pulumi/pulumi-openstack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the openstack Terraform Provider.
    openstack logo
    OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi