1. Packages
  2. Openstack Provider
  3. API Docs
  4. identity
  5. InheritRoleAssignment
OpenStack v5.0.3 published on Wednesday, Feb 12, 2025 by Pulumi

openstack.identity.InheritRoleAssignment

Explore with Pulumi AI

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,
});
Copy
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)
Copy
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v5/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
	})
}
Copy
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,
    });

});
Copy
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());

    }
}
Copy
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}
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. InheritRoleAssignmentArgs
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. 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 This property is required. string
The unique name of the resource.
args This property is required. InheritRoleAssignmentArgs
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. InheritRoleAssignmentArgs
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. 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",
});
Copy
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"),
})
Copy
var inheritRoleAssignmentResource = new InheritRoleAssignment("inheritRoleAssignmentResource", InheritRoleAssignmentArgs.builder()
    .roleId("string")
    .domainId("string")
    .groupId("string")
    .projectId("string")
    .region("string")
    .userId("string")
    .build());
Copy
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")
Copy
const inheritRoleAssignmentResource = new openstack.identity.InheritRoleAssignment("inheritRoleAssignmentResource", {
    roleId: "string",
    domainId: "string",
    groupId: "string",
    projectId: "string",
    region: "string",
    userId: "string",
});
Copy
type: openstack:identity:InheritRoleAssignment
properties:
    domainId: string
    groupId: string
    projectId: string
    region: string
    roleId: string
    userId: string
Copy

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

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

The InheritRoleAssignment resource accepts the following input properties:

RoleId
This property is required.
Changes to this property will trigger replacement.
string
The role to assign.
DomainId Changes to this property will trigger replacement. string
The domain to assign the role in.
GroupId Changes to this property will trigger replacement. string
The group to assign the role to.
ProjectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
Region Changes to this property will trigger replacement. string
UserId Changes to this property will trigger replacement. string
The user to assign the role to.
RoleId
This property is required.
Changes to this property will trigger replacement.
string
The role to assign.
DomainId Changes to this property will trigger replacement. string
The domain to assign the role in.
GroupId Changes to this property will trigger replacement. string
The group to assign the role to.
ProjectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
Region Changes to this property will trigger replacement. string
UserId Changes to this property will trigger replacement. string
The user to assign the role to.
roleId
This property is required.
Changes to this property will trigger replacement.
String
The role to assign.
domainId Changes to this property will trigger replacement. String
The domain to assign the role in.
groupId Changes to this property will trigger replacement. String
The group to assign the role to.
projectId Changes to this property will trigger replacement. String
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. String
userId Changes to this property will trigger replacement. String
The user to assign the role to.
roleId
This property is required.
Changes to this property will trigger replacement.
string
The role to assign.
domainId Changes to this property will trigger replacement. string
The domain to assign the role in.
groupId Changes to this property will trigger replacement. string
The group to assign the role to.
projectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. string
userId Changes to this property will trigger replacement. string
The user to assign the role to.
role_id
This property is required.
Changes to this property will trigger replacement.
str
The role to assign.
domain_id Changes to this property will trigger replacement. str
The domain to assign the role in.
group_id Changes to this property will trigger replacement. str
The group to assign the role to.
project_id Changes to this property will trigger replacement. str
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. str
user_id Changes to this property will trigger replacement. str
The user to assign the role to.
roleId
This property is required.
Changes to this property will trigger replacement.
String
The role to assign.
domainId Changes to this property will trigger replacement. String
The domain to assign the role in.
groupId Changes to this property will trigger replacement. String
The group to assign the role to.
projectId Changes to this property will trigger replacement. String
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. String
userId Changes to this property will trigger replacement. 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)
resources:  _:    type: openstack:identity:InheritRoleAssignment    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:
DomainId Changes to this property will trigger replacement. string
The domain to assign the role in.
GroupId Changes to this property will trigger replacement. string
The group to assign the role to.
ProjectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
Region Changes to this property will trigger replacement. string
RoleId Changes to this property will trigger replacement. string
The role to assign.
UserId Changes to this property will trigger replacement. string
The user to assign the role to.
DomainId Changes to this property will trigger replacement. string
The domain to assign the role in.
GroupId Changes to this property will trigger replacement. string
The group to assign the role to.
ProjectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
Region Changes to this property will trigger replacement. string
RoleId Changes to this property will trigger replacement. string
The role to assign.
UserId Changes to this property will trigger replacement. string
The user to assign the role to.
domainId Changes to this property will trigger replacement. String
The domain to assign the role in.
groupId Changes to this property will trigger replacement. String
The group to assign the role to.
projectId Changes to this property will trigger replacement. String
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. String
roleId Changes to this property will trigger replacement. String
The role to assign.
userId Changes to this property will trigger replacement. String
The user to assign the role to.
domainId Changes to this property will trigger replacement. string
The domain to assign the role in.
groupId Changes to this property will trigger replacement. string
The group to assign the role to.
projectId Changes to this property will trigger replacement. string
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. string
roleId Changes to this property will trigger replacement. string
The role to assign.
userId Changes to this property will trigger replacement. string
The user to assign the role to.
domain_id Changes to this property will trigger replacement. str
The domain to assign the role in.
group_id Changes to this property will trigger replacement. str
The group to assign the role to.
project_id Changes to this property will trigger replacement. str
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. str
role_id Changes to this property will trigger replacement. str
The role to assign.
user_id Changes to this property will trigger replacement. str
The user to assign the role to.
domainId Changes to this property will trigger replacement. String
The domain to assign the role in.
groupId Changes to this property will trigger replacement. String
The group to assign the role to.
projectId Changes to this property will trigger replacement. String
The project to assign the role in. The project should be able to containt child projects.
region Changes to this property will trigger replacement. String
roleId Changes to this property will trigger replacement. String
The role to assign.
userId Changes to this property will trigger replacement. 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
Copy

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.