1. Packages
  2. Zitadel
  3. API Docs
  4. UserGrant
zitadel v0.2.0 published on Monday, Mar 24, 2025 by pulumiverse

zitadel.UserGrant

Explore with Pulumi AI

Resource representing the authorization given to a user directly, including the given roles.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Zitadel = Pulumiverse.Zitadel;

return await Deployment.RunAsync(() => 
{
    var @default = new Zitadel.UserGrant("default", new()
    {
        ProjectId = defaultZitadelProject.Id,
        OrgId = defaultZitadelOrg.Id,
        RoleKeys = new[]
        {
            "super-user",
        },
        UserId = defaultZitadelHumanUser.Id,
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-zitadel/sdk/go/zitadel"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := zitadel.NewUserGrant(ctx, "default", &zitadel.UserGrantArgs{
			ProjectId: pulumi.Any(defaultZitadelProject.Id),
			OrgId:     pulumi.Any(defaultZitadelOrg.Id),
			RoleKeys: pulumi.StringArray{
				pulumi.String("super-user"),
			},
			UserId: pulumi.Any(defaultZitadelHumanUser.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.zitadel.UserGrant;
import com.pulumi.zitadel.UserGrantArgs;
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 default_ = new UserGrant("default", UserGrantArgs.builder()        
            .projectId(defaultZitadelProject.id())
            .orgId(defaultZitadelOrg.id())
            .roleKeys("super-user")
            .userId(defaultZitadelHumanUser.id())
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as zitadel from "@pulumiverse/zitadel";

const _default = new zitadel.UserGrant("default", {
    projectId: defaultZitadelProject.id,
    orgId: defaultZitadelOrg.id,
    roleKeys: ["super-user"],
    userId: defaultZitadelHumanUser.id,
});
Copy
import pulumi
import pulumiverse_zitadel as zitadel

default = zitadel.UserGrant("default",
    project_id=default_zitadel_project["id"],
    org_id=default_zitadel_org["id"],
    role_keys=["super-user"],
    user_id=default_zitadel_human_user["id"])
Copy
resources:
  default:
    type: zitadel:UserGrant
    properties:
      projectId: ${defaultZitadelProject.id}
      orgId: ${defaultZitadelOrg.id}
      roleKeys:
        - super-user
      userId: ${defaultZitadelHumanUser.id}
Copy

Create UserGrant Resource

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

Constructor syntax

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

@overload
def UserGrant(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              user_id: Optional[str] = None,
              org_id: Optional[str] = None,
              project_grant_id: Optional[str] = None,
              project_id: Optional[str] = None,
              role_keys: Optional[Sequence[str]] = None)
func NewUserGrant(ctx *Context, name string, args UserGrantArgs, opts ...ResourceOption) (*UserGrant, error)
public UserGrant(string name, UserGrantArgs args, CustomResourceOptions? opts = null)
public UserGrant(String name, UserGrantArgs args)
public UserGrant(String name, UserGrantArgs args, CustomResourceOptions options)
type: zitadel:UserGrant
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. UserGrantArgs
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. UserGrantArgs
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. UserGrantArgs
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. UserGrantArgs
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. UserGrantArgs
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 userGrantResource = new Zitadel.UserGrant("userGrantResource", new()
{
    UserId = "string",
    OrgId = "string",
    ProjectGrantId = "string",
    ProjectId = "string",
    RoleKeys = new[]
    {
        "string",
    },
});
Copy
example, err := zitadel.NewUserGrant(ctx, "userGrantResource", &zitadel.UserGrantArgs{
	UserId:         pulumi.String("string"),
	OrgId:          pulumi.String("string"),
	ProjectGrantId: pulumi.String("string"),
	ProjectId:      pulumi.String("string"),
	RoleKeys: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var userGrantResource = new UserGrant("userGrantResource", UserGrantArgs.builder()
    .userId("string")
    .orgId("string")
    .projectGrantId("string")
    .projectId("string")
    .roleKeys("string")
    .build());
Copy
user_grant_resource = zitadel.UserGrant("userGrantResource",
    user_id="string",
    org_id="string",
    project_grant_id="string",
    project_id="string",
    role_keys=["string"])
Copy
const userGrantResource = new zitadel.UserGrant("userGrantResource", {
    userId: "string",
    orgId: "string",
    projectGrantId: "string",
    projectId: "string",
    roleKeys: ["string"],
});
Copy
type: zitadel:UserGrant
properties:
    orgId: string
    projectGrantId: string
    projectId: string
    roleKeys:
        - string
    userId: string
Copy

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

UserId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
OrgId Changes to this property will trigger replacement. string
ID of the organization
ProjectGrantId Changes to this property will trigger replacement. string
ID of the granted project
ProjectId Changes to this property will trigger replacement. string
ID of the project
RoleKeys List<string>
List of roles granted
UserId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
OrgId Changes to this property will trigger replacement. string
ID of the organization
ProjectGrantId Changes to this property will trigger replacement. string
ID of the granted project
ProjectId Changes to this property will trigger replacement. string
ID of the project
RoleKeys []string
List of roles granted
userId
This property is required.
Changes to this property will trigger replacement.
String
ID of the user
orgId Changes to this property will trigger replacement. String
ID of the organization
projectGrantId Changes to this property will trigger replacement. String
ID of the granted project
projectId Changes to this property will trigger replacement. String
ID of the project
roleKeys List<String>
List of roles granted
userId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
orgId Changes to this property will trigger replacement. string
ID of the organization
projectGrantId Changes to this property will trigger replacement. string
ID of the granted project
projectId Changes to this property will trigger replacement. string
ID of the project
roleKeys string[]
List of roles granted
user_id
This property is required.
Changes to this property will trigger replacement.
str
ID of the user
org_id Changes to this property will trigger replacement. str
ID of the organization
project_grant_id Changes to this property will trigger replacement. str
ID of the granted project
project_id Changes to this property will trigger replacement. str
ID of the project
role_keys Sequence[str]
List of roles granted
userId
This property is required.
Changes to this property will trigger replacement.
String
ID of the user
orgId Changes to this property will trigger replacement. String
ID of the organization
projectGrantId Changes to this property will trigger replacement. String
ID of the granted project
projectId Changes to this property will trigger replacement. String
ID of the project
roleKeys List<String>
List of roles granted

Outputs

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

Get an existing UserGrant 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?: UserGrantState, opts?: CustomResourceOptions): UserGrant
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        org_id: Optional[str] = None,
        project_grant_id: Optional[str] = None,
        project_id: Optional[str] = None,
        role_keys: Optional[Sequence[str]] = None,
        user_id: Optional[str] = None) -> UserGrant
func GetUserGrant(ctx *Context, name string, id IDInput, state *UserGrantState, opts ...ResourceOption) (*UserGrant, error)
public static UserGrant Get(string name, Input<string> id, UserGrantState? state, CustomResourceOptions? opts = null)
public static UserGrant get(String name, Output<String> id, UserGrantState state, CustomResourceOptions options)
resources:  _:    type: zitadel:UserGrant    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:
OrgId Changes to this property will trigger replacement. string
ID of the organization
ProjectGrantId Changes to this property will trigger replacement. string
ID of the granted project
ProjectId Changes to this property will trigger replacement. string
ID of the project
RoleKeys List<string>
List of roles granted
UserId Changes to this property will trigger replacement. string
ID of the user
OrgId Changes to this property will trigger replacement. string
ID of the organization
ProjectGrantId Changes to this property will trigger replacement. string
ID of the granted project
ProjectId Changes to this property will trigger replacement. string
ID of the project
RoleKeys []string
List of roles granted
UserId Changes to this property will trigger replacement. string
ID of the user
orgId Changes to this property will trigger replacement. String
ID of the organization
projectGrantId Changes to this property will trigger replacement. String
ID of the granted project
projectId Changes to this property will trigger replacement. String
ID of the project
roleKeys List<String>
List of roles granted
userId Changes to this property will trigger replacement. String
ID of the user
orgId Changes to this property will trigger replacement. string
ID of the organization
projectGrantId Changes to this property will trigger replacement. string
ID of the granted project
projectId Changes to this property will trigger replacement. string
ID of the project
roleKeys string[]
List of roles granted
userId Changes to this property will trigger replacement. string
ID of the user
org_id Changes to this property will trigger replacement. str
ID of the organization
project_grant_id Changes to this property will trigger replacement. str
ID of the granted project
project_id Changes to this property will trigger replacement. str
ID of the project
role_keys Sequence[str]
List of roles granted
user_id Changes to this property will trigger replacement. str
ID of the user
orgId Changes to this property will trigger replacement. String
ID of the organization
projectGrantId Changes to this property will trigger replacement. String
ID of the granted project
projectId Changes to this property will trigger replacement. String
ID of the project
roleKeys List<String>
List of roles granted
userId Changes to this property will trigger replacement. String
ID of the user

Import

bash The resource can be imported using the ID format <flow_type:trigger_type[:org_id]>, e.g.

 $ pulumi import zitadel:index/userGrant:UserGrant imported '123456789012345678:123456789012345678:123456789012345678'
Copy

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

Package Details

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