1. Packages
  2. Onelogin Provider
  3. API Docs
  4. UserCustomAttributes
onelogin 0.6.0 published on Monday, May 12, 2025 by onelogin

onelogin.UserCustomAttributes

Explore with Pulumi AI

onelogin logo
onelogin 0.6.0 published on Monday, May 12, 2025 by onelogin

    # onelogin.UserCustomAttributes Resource

    This resource allows you to manage custom user attributes in OneLogin. You can:

    1. Create, read, update, and delete custom attribute definitions
    2. Set, update, and remove custom attribute values for specific users

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as onelogin from "@pulumi/onelogin";
    
    // Create a user
    const testUser = new onelogin.Users("testUser", {
        username: "test.user",
        email: "test.user@example.com",
    });
    // Create a custom attribute definition (schema)
    const employeeIdDefinition = new onelogin.UserCustomAttributes("employeeIdDefinition", {shortname: "employee_id"});
    // Technical name/identifier for the attribute
    // Create another custom attribute definition
    const departmentDefinition = new onelogin.UserCustomAttributes("departmentDefinition", {shortname: "dept_code"});
    // Set a custom attribute value for a specific user
    const userEmployeeId = new onelogin.UserCustomAttributes("userEmployeeId", {
        userId: testUser.usersId,
        shortname: "employee_id",
        value: "EMP12345",
    });
    // Set another custom attribute value for the same user
    const userDepartmentCode = new onelogin.UserCustomAttributes("userDepartmentCode", {
        userId: testUser.usersId,
        shortname: "dept_code",
        value: "IT-DEPT",
    });
    
    import pulumi
    import pulumi_onelogin as onelogin
    
    # Create a user
    test_user = onelogin.Users("testUser",
        username="test.user",
        email="test.user@example.com")
    # Create a custom attribute definition (schema)
    employee_id_definition = onelogin.UserCustomAttributes("employeeIdDefinition", shortname="employee_id")
    # Technical name/identifier for the attribute
    # Create another custom attribute definition
    department_definition = onelogin.UserCustomAttributes("departmentDefinition", shortname="dept_code")
    # Set a custom attribute value for a specific user
    user_employee_id = onelogin.UserCustomAttributes("userEmployeeId",
        user_id=test_user.users_id,
        shortname="employee_id",
        value="EMP12345")
    # Set another custom attribute value for the same user
    user_department_code = onelogin.UserCustomAttributes("userDepartmentCode",
        user_id=test_user.users_id,
        shortname="dept_code",
        value="IT-DEPT")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/onelogin/onelogin"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a user
    		testUser, err := onelogin.NewUsers(ctx, "testUser", &onelogin.UsersArgs{
    			Username: pulumi.String("test.user"),
    			Email:    pulumi.String("test.user@example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create a custom attribute definition (schema)
    		_, err = onelogin.NewUserCustomAttributes(ctx, "employeeIdDefinition", &onelogin.UserCustomAttributesArgs{
    			Shortname: pulumi.String("employee_id"),
    		})
    		if err != nil {
    			return err
    		}
    		// Create another custom attribute definition
    		_, err = onelogin.NewUserCustomAttributes(ctx, "departmentDefinition", &onelogin.UserCustomAttributesArgs{
    			Shortname: pulumi.String("dept_code"),
    		})
    		if err != nil {
    			return err
    		}
    		// Set a custom attribute value for a specific user
    		_, err = onelogin.NewUserCustomAttributes(ctx, "userEmployeeId", &onelogin.UserCustomAttributesArgs{
    			UserId:    testUser.UsersId,
    			Shortname: pulumi.String("employee_id"),
    			Value:     pulumi.String("EMP12345"),
    		})
    		if err != nil {
    			return err
    		}
    		// Set another custom attribute value for the same user
    		_, err = onelogin.NewUserCustomAttributes(ctx, "userDepartmentCode", &onelogin.UserCustomAttributesArgs{
    			UserId:    testUser.UsersId,
    			Shortname: pulumi.String("dept_code"),
    			Value:     pulumi.String("IT-DEPT"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Onelogin = Pulumi.Onelogin;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a user
        var testUser = new Onelogin.Users("testUser", new()
        {
            Username = "test.user",
            Email = "test.user@example.com",
        });
    
        // Create a custom attribute definition (schema)
        var employeeIdDefinition = new Onelogin.UserCustomAttributes("employeeIdDefinition", new()
        {
            Shortname = "employee_id",
        });
    
        // Technical name/identifier for the attribute
        // Create another custom attribute definition
        var departmentDefinition = new Onelogin.UserCustomAttributes("departmentDefinition", new()
        {
            Shortname = "dept_code",
        });
    
        // Set a custom attribute value for a specific user
        var userEmployeeId = new Onelogin.UserCustomAttributes("userEmployeeId", new()
        {
            UserId = testUser.UsersId,
            Shortname = "employee_id",
            Value = "EMP12345",
        });
    
        // Set another custom attribute value for the same user
        var userDepartmentCode = new Onelogin.UserCustomAttributes("userDepartmentCode", new()
        {
            UserId = testUser.UsersId,
            Shortname = "dept_code",
            Value = "IT-DEPT",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.onelogin.Users;
    import com.pulumi.onelogin.UsersArgs;
    import com.pulumi.onelogin.UserCustomAttributes;
    import com.pulumi.onelogin.UserCustomAttributesArgs;
    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) {
            // Create a user
            var testUser = new Users("testUser", UsersArgs.builder()
                .username("test.user")
                .email("test.user@example.com")
                .build());
    
            // Create a custom attribute definition (schema)
            var employeeIdDefinition = new UserCustomAttributes("employeeIdDefinition", UserCustomAttributesArgs.builder()
                .shortname("employee_id")
                .build());
    
            // Technical name/identifier for the attribute
            // Create another custom attribute definition
            var departmentDefinition = new UserCustomAttributes("departmentDefinition", UserCustomAttributesArgs.builder()
                .shortname("dept_code")
                .build());
    
            // Set a custom attribute value for a specific user
            var userEmployeeId = new UserCustomAttributes("userEmployeeId", UserCustomAttributesArgs.builder()
                .userId(testUser.usersId())
                .shortname("employee_id")
                .value("EMP12345")
                .build());
    
            // Set another custom attribute value for the same user
            var userDepartmentCode = new UserCustomAttributes("userDepartmentCode", UserCustomAttributesArgs.builder()
                .userId(testUser.usersId())
                .shortname("dept_code")
                .value("IT-DEPT")
                .build());
    
        }
    }
    
    resources:
      # Create a user
      testUser:
        type: onelogin:Users
        properties:
          username: test.user
          email: test.user@example.com
      # Create a custom attribute definition (schema)
      employeeIdDefinition:
        type: onelogin:UserCustomAttributes
        properties:
          # Display name shown in the UI
          shortname: employee_id
      # Create another custom attribute definition
      departmentDefinition:
        type: onelogin:UserCustomAttributes
        properties:
          shortname: dept_code
      # Set a custom attribute value for a specific user
      userEmployeeId:
        type: onelogin:UserCustomAttributes
        properties:
          userId: ${testUser.usersId}
          shortname: employee_id
          # Must match an existing attribute in OneLogin
          value: EMP12345
      # Set another custom attribute value for the same user
      userDepartmentCode:
        type: onelogin:UserCustomAttributes
        properties:
          userId: ${testUser.usersId}
          shortname: dept_code
          # Must match an existing attribute
          value: IT-DEPT
    

    Create UserCustomAttributes Resource

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

    Constructor syntax

    new UserCustomAttributes(name: string, args: UserCustomAttributesArgs, opts?: CustomResourceOptions);
    @overload
    def UserCustomAttributes(resource_name: str,
                             args: UserCustomAttributesArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserCustomAttributes(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             shortname: Optional[str] = None,
                             name: Optional[str] = None,
                             user_custom_attributes_id: Optional[str] = None,
                             user_id: Optional[float] = None,
                             value: Optional[str] = None)
    func NewUserCustomAttributes(ctx *Context, name string, args UserCustomAttributesArgs, opts ...ResourceOption) (*UserCustomAttributes, error)
    public UserCustomAttributes(string name, UserCustomAttributesArgs args, CustomResourceOptions? opts = null)
    public UserCustomAttributes(String name, UserCustomAttributesArgs args)
    public UserCustomAttributes(String name, UserCustomAttributesArgs args, CustomResourceOptions options)
    
    type: onelogin:UserCustomAttributes
    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 UserCustomAttributesArgs
    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 UserCustomAttributesArgs
    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 UserCustomAttributesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserCustomAttributesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserCustomAttributesArgs
    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 userCustomAttributesResource = new Onelogin.UserCustomAttributes("userCustomAttributesResource", new()
    {
        Shortname = "string",
        Name = "string",
        UserCustomAttributesId = "string",
        UserId = 0,
        Value = "string",
    });
    
    example, err := onelogin.NewUserCustomAttributes(ctx, "userCustomAttributesResource", &onelogin.UserCustomAttributesArgs{
    	Shortname:              pulumi.String("string"),
    	Name:                   pulumi.String("string"),
    	UserCustomAttributesId: pulumi.String("string"),
    	UserId:                 pulumi.Float64(0),
    	Value:                  pulumi.String("string"),
    })
    
    var userCustomAttributesResource = new UserCustomAttributes("userCustomAttributesResource", UserCustomAttributesArgs.builder()
        .shortname("string")
        .name("string")
        .userCustomAttributesId("string")
        .userId(0.0)
        .value("string")
        .build());
    
    user_custom_attributes_resource = onelogin.UserCustomAttributes("userCustomAttributesResource",
        shortname="string",
        name="string",
        user_custom_attributes_id="string",
        user_id=0,
        value="string")
    
    const userCustomAttributesResource = new onelogin.UserCustomAttributes("userCustomAttributesResource", {
        shortname: "string",
        name: "string",
        userCustomAttributesId: "string",
        userId: 0,
        value: "string",
    });
    
    type: onelogin:UserCustomAttributes
    properties:
        name: string
        shortname: string
        userCustomAttributesId: string
        userId: 0
        value: string
    

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

    Shortname string
    Short name identifier for the custom attribute
    Name string
    Name of the custom attribute
    UserCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    UserId double
    User ID to set this custom attribute for (for user-specific custom attributes)
    Value string
    Value of the custom attribute (for user-specific custom attributes)
    Shortname string
    Short name identifier for the custom attribute
    Name string
    Name of the custom attribute
    UserCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    UserId float64
    User ID to set this custom attribute for (for user-specific custom attributes)
    Value string
    Value of the custom attribute (for user-specific custom attributes)
    shortname String
    Short name identifier for the custom attribute
    name String
    Name of the custom attribute
    userCustomAttributesId String
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId Double
    User ID to set this custom attribute for (for user-specific custom attributes)
    value String
    Value of the custom attribute (for user-specific custom attributes)
    shortname string
    Short name identifier for the custom attribute
    name string
    Name of the custom attribute
    userCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId number
    User ID to set this custom attribute for (for user-specific custom attributes)
    value string
    Value of the custom attribute (for user-specific custom attributes)
    shortname str
    Short name identifier for the custom attribute
    name str
    Name of the custom attribute
    user_custom_attributes_id str
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    user_id float
    User ID to set this custom attribute for (for user-specific custom attributes)
    value str
    Value of the custom attribute (for user-specific custom attributes)
    shortname String
    Short name identifier for the custom attribute
    name String
    Name of the custom attribute
    userCustomAttributesId String
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId Number
    User ID to set this custom attribute for (for user-specific custom attributes)
    value String
    Value of the custom attribute (for user-specific custom attributes)

    Outputs

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

    Get an existing UserCustomAttributes 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?: UserCustomAttributesState, opts?: CustomResourceOptions): UserCustomAttributes
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            shortname: Optional[str] = None,
            user_custom_attributes_id: Optional[str] = None,
            user_id: Optional[float] = None,
            value: Optional[str] = None) -> UserCustomAttributes
    func GetUserCustomAttributes(ctx *Context, name string, id IDInput, state *UserCustomAttributesState, opts ...ResourceOption) (*UserCustomAttributes, error)
    public static UserCustomAttributes Get(string name, Input<string> id, UserCustomAttributesState? state, CustomResourceOptions? opts = null)
    public static UserCustomAttributes get(String name, Output<String> id, UserCustomAttributesState state, CustomResourceOptions options)
    resources:  _:    type: onelogin:UserCustomAttributes    get:      id: ${id}
    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:
    Name string
    Name of the custom attribute
    Shortname string
    Short name identifier for the custom attribute
    UserCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    UserId double
    User ID to set this custom attribute for (for user-specific custom attributes)
    Value string
    Value of the custom attribute (for user-specific custom attributes)
    Name string
    Name of the custom attribute
    Shortname string
    Short name identifier for the custom attribute
    UserCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    UserId float64
    User ID to set this custom attribute for (for user-specific custom attributes)
    Value string
    Value of the custom attribute (for user-specific custom attributes)
    name String
    Name of the custom attribute
    shortname String
    Short name identifier for the custom attribute
    userCustomAttributesId String
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId Double
    User ID to set this custom attribute for (for user-specific custom attributes)
    value String
    Value of the custom attribute (for user-specific custom attributes)
    name string
    Name of the custom attribute
    shortname string
    Short name identifier for the custom attribute
    userCustomAttributesId string
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId number
    User ID to set this custom attribute for (for user-specific custom attributes)
    value string
    Value of the custom attribute (for user-specific custom attributes)
    name str
    Name of the custom attribute
    shortname str
    Short name identifier for the custom attribute
    user_custom_attributes_id str
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    user_id float
    User ID to set this custom attribute for (for user-specific custom attributes)
    value str
    Value of the custom attribute (for user-specific custom attributes)
    name String
    Name of the custom attribute
    shortname String
    Short name identifier for the custom attribute
    userCustomAttributesId String
    For user-specific attribute values, the composite ID with the format {user_id}_{shortname}.
    userId Number
    User ID to set this custom attribute for (for user-specific custom attributes)
    value String
    Value of the custom attribute (for user-specific custom attributes)

    Import

    User-Specific Custom Attribute Values

    User-specific custom attribute values can be imported using the format {user_id}_{shortname}:

    bash

    $ pulumi import onelogin:index/userCustomAttributes:UserCustomAttributes user_employee_id 789012_employee_id
    

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

    Package Details

    Repository
    onelogin onelogin/terraform-provider-onelogin
    License
    Notes
    This Pulumi package is based on the onelogin Terraform Provider.
    onelogin logo
    onelogin 0.6.0 published on Monday, May 12, 2025 by onelogin