1. Packages
  2. OpenStack
  3. API Docs
  4. identity
  5. InheritRoleAssignment
OpenStack v4.0.0 published on Tuesday, May 21, 2024 by Pulumi

openstack.identity.InheritRoleAssignment

Explore with Pulumi AI

openstack logo
OpenStack v4.0.0 published on Tuesday, May 21, 2024 by Pulumi

    Manages a V3 Inherit Role assignment within OpenStack Keystone. This uses the Openstack keystone OS-INHERIT api to created inherit roles within domains and parent projects for users and groups.

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const user1 = new openstack.identity.User("user_1", {
        name: "user_1",
        domainId: "default",
    });
    const role1 = new openstack.identity.Role("role_1", {
        name: "role_1",
        domainId: "default",
    });
    const roleAssignment1 = new openstack.identity.InheritRoleAssignment("role_assignment_1", {
        userId: user1.id,
        domainId: "default",
        roleId: role1.id,
    });
    
    import pulumi
    import pulumi_openstack as openstack
    
    user1 = openstack.identity.User("user_1",
        name="user_1",
        domain_id="default")
    role1 = openstack.identity.Role("role_1",
        name="role_1",
        domain_id="default")
    role_assignment1 = openstack.identity.InheritRoleAssignment("role_assignment_1",
        user_id=user1.id,
        domain_id="default",
        role_id=role1.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v4/go/openstack/identity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		user1, err := identity.NewUser(ctx, "user_1", &identity.UserArgs{
    			Name:     pulumi.String("user_1"),
    			DomainId: pulumi.String("default"),
    		})
    		if err != nil {
    			return err
    		}
    		role1, err := identity.NewRole(ctx, "role_1", &identity.RoleArgs{
    			Name:     pulumi.String("role_1"),
    			DomainId: pulumi.String("default"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = identity.NewInheritRoleAssignment(ctx, "role_assignment_1", &identity.InheritRoleAssignmentArgs{
    			UserId:   user1.ID(),
    			DomainId: pulumi.String("default"),
    			RoleId:   role1.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var user1 = new OpenStack.Identity.User("user_1", new()
        {
            Name = "user_1",
            DomainId = "default",
        });
    
        var role1 = new OpenStack.Identity.Role("role_1", new()
        {
            Name = "role_1",
            DomainId = "default",
        });
    
        var roleAssignment1 = new OpenStack.Identity.InheritRoleAssignment("role_assignment_1", new()
        {
            UserId = user1.Id,
            DomainId = "default",
            RoleId = role1.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.openstack.identity.User;
    import com.pulumi.openstack.identity.UserArgs;
    import com.pulumi.openstack.identity.Role;
    import com.pulumi.openstack.identity.RoleArgs;
    import com.pulumi.openstack.identity.InheritRoleAssignment;
    import com.pulumi.openstack.identity.InheritRoleAssignmentArgs;
    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 user1 = new User("user1", UserArgs.builder()        
                .name("user_1")
                .domainId("default")
                .build());
    
            var role1 = new Role("role1", RoleArgs.builder()        
                .name("role_1")
                .domainId("default")
                .build());
    
            var roleAssignment1 = new InheritRoleAssignment("roleAssignment1", InheritRoleAssignmentArgs.builder()        
                .userId(user1.id())
                .domainId("default")
                .roleId(role1.id())
                .build());
    
        }
    }
    
    resources:
      user1:
        type: openstack:identity:User
        name: user_1
        properties:
          name: user_1
          domainId: default
      role1:
        type: openstack:identity:Role
        name: role_1
        properties:
          name: role_1
          domainId: default
      roleAssignment1:
        type: openstack:identity:InheritRoleAssignment
        name: role_assignment_1
        properties:
          userId: ${user1.id}
          domainId: default
          roleId: ${role1.id}
    

    Create InheritRoleAssignment Resource

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

    Constructor syntax

    new InheritRoleAssignment(name: string, args: InheritRoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def InheritRoleAssignment(resource_name: str,
                              args: InheritRoleAssignmentArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def InheritRoleAssignment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              role_id: Optional[str] = None,
                              domain_id: Optional[str] = None,
                              group_id: Optional[str] = None,
                              project_id: Optional[str] = None,
                              region: Optional[str] = None,
                              user_id: Optional[str] = None)
    func NewInheritRoleAssignment(ctx *Context, name string, args InheritRoleAssignmentArgs, opts ...ResourceOption) (*InheritRoleAssignment, error)
    public InheritRoleAssignment(string name, InheritRoleAssignmentArgs args, CustomResourceOptions? opts = null)
    public InheritRoleAssignment(String name, InheritRoleAssignmentArgs args)
    public InheritRoleAssignment(String name, InheritRoleAssignmentArgs args, CustomResourceOptions options)
    
    type: openstack:identity:InheritRoleAssignment
    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 InheritRoleAssignmentArgs
    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 InheritRoleAssignmentArgs
    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 InheritRoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InheritRoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InheritRoleAssignmentArgs
    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 inheritRoleAssignmentResource = new OpenStack.Identity.InheritRoleAssignment("inheritRoleAssignmentResource", new()
    {
        RoleId = "string",
        DomainId = "string",
        GroupId = "string",
        ProjectId = "string",
        Region = "string",
        UserId = "string",
    });
    
    example, err := identity.NewInheritRoleAssignment(ctx, "inheritRoleAssignmentResource", &identity.InheritRoleAssignmentArgs{
    	RoleId:    pulumi.String("string"),
    	DomainId:  pulumi.String("string"),
    	GroupId:   pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	Region:    pulumi.String("string"),
    	UserId:    pulumi.String("string"),
    })
    
    var inheritRoleAssignmentResource = new InheritRoleAssignment("inheritRoleAssignmentResource", InheritRoleAssignmentArgs.builder()
        .roleId("string")
        .domainId("string")
        .groupId("string")
        .projectId("string")
        .region("string")
        .userId("string")
        .build());
    
    inherit_role_assignment_resource = openstack.identity.InheritRoleAssignment("inheritRoleAssignmentResource",
        role_id="string",
        domain_id="string",
        group_id="string",
        project_id="string",
        region="string",
        user_id="string")
    
    const inheritRoleAssignmentResource = new openstack.identity.InheritRoleAssignment("inheritRoleAssignmentResource", {
        roleId: "string",
        domainId: "string",
        groupId: "string",
        projectId: "string",
        region: "string",
        userId: "string",
    });
    
    type: openstack:identity:InheritRoleAssignment
    properties:
        domainId: string
        groupId: string
        projectId: string
        region: string
        roleId: string
        userId: string
    

    InheritRoleAssignment 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 InheritRoleAssignment 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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    region String
    userId String
    The user to assign the role to.

    Outputs

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

    Get an existing InheritRoleAssignment 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?: InheritRoleAssignmentState, opts?: CustomResourceOptions): InheritRoleAssignment
    @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) -> InheritRoleAssignment
    func GetInheritRoleAssignment(ctx *Context, name string, id IDInput, state *InheritRoleAssignmentState, opts ...ResourceOption) (*InheritRoleAssignment, error)
    public static InheritRoleAssignment Get(string name, Input<string> id, InheritRoleAssignmentState? state, CustomResourceOptions? opts = null)
    public static InheritRoleAssignment get(String name, Output<String> id, InheritRoleAssignmentState 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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    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. The project should be able to containt child projects.
    region String
    roleId String
    The role to assign.
    userId String
    The user to assign the role to.

    Import

    Inherit 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 inherit role assignment for: projectID: 014395cd-89fc-4c9b-96b7-13d1ee79dad2, userID: 4142e64b-1b35-44a0-9b1e-5affc7af1106, roleID: ea257959-eeb1-4c10-8d33-26f0409a755d ( domainID and groupID are left blank)

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

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

    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 v4.0.0 published on Tuesday, May 21, 2024 by Pulumi