1. Packages
  2. Gitlab Provider
  3. API Docs
  4. UserIdentity
GitLab v8.10.0 published on Friday, Mar 21, 2025 by Pulumi

gitlab.UserIdentity

Explore with Pulumi AI

The gitlab.UserIdentity resource is for managing the lifecycle of a user’s external identity.

the provider needs to be configured with admin-level access for this resource to work.

Upstream API: GitLab REST API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

const example = new gitlab.User("example", {
    name: "Example Foo",
    username: "example",
    email: "gitlab@user.create",
    isAdmin: true,
    projectsLimit: 4,
    canCreateGroup: false,
    isExternal: true,
});
const exampleUserIdentity = new gitlab.UserIdentity("example", {
    userId: example.id,
    externalProvider: "google",
    externalUid: "1234567890",
});
Copy
import pulumi
import pulumi_gitlab as gitlab

example = gitlab.User("example",
    name="Example Foo",
    username="example",
    email="gitlab@user.create",
    is_admin=True,
    projects_limit=4,
    can_create_group=False,
    is_external=True)
example_user_identity = gitlab.UserIdentity("example",
    user_id=example.id,
    external_provider="google",
    external_uid="1234567890")
Copy
package main

import (
	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := gitlab.NewUser(ctx, "example", &gitlab.UserArgs{
			Name:           pulumi.String("Example Foo"),
			Username:       pulumi.String("example"),
			Email:          pulumi.String("gitlab@user.create"),
			IsAdmin:        pulumi.Bool(true),
			ProjectsLimit:  pulumi.Int(4),
			CanCreateGroup: pulumi.Bool(false),
			IsExternal:     pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = gitlab.NewUserIdentity(ctx, "example", &gitlab.UserIdentityArgs{
			UserId:           example.ID(),
			ExternalProvider: pulumi.String("google"),
			ExternalUid:      pulumi.String("1234567890"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;

return await Deployment.RunAsync(() => 
{
    var example = new GitLab.User("example", new()
    {
        Name = "Example Foo",
        Username = "example",
        Email = "gitlab@user.create",
        IsAdmin = true,
        ProjectsLimit = 4,
        CanCreateGroup = false,
        IsExternal = true,
    });

    var exampleUserIdentity = new GitLab.UserIdentity("example", new()
    {
        UserId = example.Id,
        ExternalProvider = "google",
        ExternalUid = "1234567890",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.User;
import com.pulumi.gitlab.UserArgs;
import com.pulumi.gitlab.UserIdentity;
import com.pulumi.gitlab.UserIdentityArgs;
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 example = new User("example", UserArgs.builder()
            .name("Example Foo")
            .username("example")
            .email("gitlab@user.create")
            .isAdmin(true)
            .projectsLimit(4)
            .canCreateGroup(false)
            .isExternal(true)
            .build());

        var exampleUserIdentity = new UserIdentity("exampleUserIdentity", UserIdentityArgs.builder()
            .userId(example.id())
            .externalProvider("google")
            .externalUid("1234567890")
            .build());

    }
}
Copy
resources:
  example:
    type: gitlab:User
    properties:
      name: Example Foo
      username: example
      email: gitlab@user.create
      isAdmin: true
      projectsLimit: 4
      canCreateGroup: false
      isExternal: true
  exampleUserIdentity:
    type: gitlab:UserIdentity
    name: example
    properties:
      userId: ${example.id}
      externalProvider: google
      externalUid: '1234567890'
Copy

Create UserIdentity Resource

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

Constructor syntax

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

@overload
def UserIdentity(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 external_provider: Optional[str] = None,
                 external_uid: Optional[str] = None,
                 user_id: Optional[int] = None)
func NewUserIdentity(ctx *Context, name string, args UserIdentityArgs, opts ...ResourceOption) (*UserIdentity, error)
public UserIdentity(string name, UserIdentityArgs args, CustomResourceOptions? opts = null)
public UserIdentity(String name, UserIdentityArgs args)
public UserIdentity(String name, UserIdentityArgs args, CustomResourceOptions options)
type: gitlab:UserIdentity
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. UserIdentityArgs
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. UserIdentityArgs
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. UserIdentityArgs
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. UserIdentityArgs
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. UserIdentityArgs
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 userIdentityResource = new GitLab.UserIdentity("userIdentityResource", new()
{
    ExternalProvider = "string",
    ExternalUid = "string",
    UserId = 0,
});
Copy
example, err := gitlab.NewUserIdentity(ctx, "userIdentityResource", &gitlab.UserIdentityArgs{
	ExternalProvider: pulumi.String("string"),
	ExternalUid:      pulumi.String("string"),
	UserId:           pulumi.Int(0),
})
Copy
var userIdentityResource = new UserIdentity("userIdentityResource", UserIdentityArgs.builder()
    .externalProvider("string")
    .externalUid("string")
    .userId(0)
    .build());
Copy
user_identity_resource = gitlab.UserIdentity("userIdentityResource",
    external_provider="string",
    external_uid="string",
    user_id=0)
Copy
const userIdentityResource = new gitlab.UserIdentity("userIdentityResource", {
    externalProvider: "string",
    externalUid: "string",
    userId: 0,
});
Copy
type: gitlab:UserIdentity
properties:
    externalProvider: string
    externalUid: string
    userId: 0
Copy

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

ExternalProvider This property is required. string
The external provider name.
ExternalUid This property is required. string
A specific external authentication provider UID.
UserId This property is required. int
The GitLab ID of the user.
ExternalProvider This property is required. string
The external provider name.
ExternalUid This property is required. string
A specific external authentication provider UID.
UserId This property is required. int
The GitLab ID of the user.
externalProvider This property is required. String
The external provider name.
externalUid This property is required. String
A specific external authentication provider UID.
userId This property is required. Integer
The GitLab ID of the user.
externalProvider This property is required. string
The external provider name.
externalUid This property is required. string
A specific external authentication provider UID.
userId This property is required. number
The GitLab ID of the user.
external_provider This property is required. str
The external provider name.
external_uid This property is required. str
A specific external authentication provider UID.
user_id This property is required. int
The GitLab ID of the user.
externalProvider This property is required. String
The external provider name.
externalUid This property is required. String
A specific external authentication provider UID.
userId This property is required. Number
The GitLab ID of the user.

Outputs

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

Get an existing UserIdentity 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?: UserIdentityState, opts?: CustomResourceOptions): UserIdentity
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        external_provider: Optional[str] = None,
        external_uid: Optional[str] = None,
        user_id: Optional[int] = None) -> UserIdentity
func GetUserIdentity(ctx *Context, name string, id IDInput, state *UserIdentityState, opts ...ResourceOption) (*UserIdentity, error)
public static UserIdentity Get(string name, Input<string> id, UserIdentityState? state, CustomResourceOptions? opts = null)
public static UserIdentity get(String name, Output<String> id, UserIdentityState state, CustomResourceOptions options)
resources:  _:    type: gitlab:UserIdentity    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:
ExternalProvider string
The external provider name.
ExternalUid string
A specific external authentication provider UID.
UserId int
The GitLab ID of the user.
ExternalProvider string
The external provider name.
ExternalUid string
A specific external authentication provider UID.
UserId int
The GitLab ID of the user.
externalProvider String
The external provider name.
externalUid String
A specific external authentication provider UID.
userId Integer
The GitLab ID of the user.
externalProvider string
The external provider name.
externalUid string
A specific external authentication provider UID.
userId number
The GitLab ID of the user.
external_provider str
The external provider name.
external_uid str
A specific external authentication provider UID.
user_id int
The GitLab ID of the user.
externalProvider String
The external provider name.
externalUid String
A specific external authentication provider UID.
userId Number
The GitLab ID of the user.

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_user_identity. For example:

terraform

import {

to = gitlab_user_identity.example

id = “see CLI command below for ID”

}

Import using the CLI is supported using the following syntax:

$ pulumi import gitlab:index/userIdentity:UserIdentity You can import a user identity to terraform state using `<resource> <id>`.
Copy

The id must be a string for the id of the user and identity provider you want to import,

for example:

$ pulumi import gitlab:index/userIdentity:UserIdentity example "42:google"
Copy

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

Package Details

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