1. Packages
  2. Harness
  3. API Docs
  4. platform
  5. User
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

harness.platform.User

Explore with Pulumi AI

harness logo
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

    Resource for creating a Harness User. This requires your authentication mechanism to be set to SAML, LDAP, or OAuth, and the feature flag AUTO_ACCEPT_SAML_ACCOUNT_INVITES to be enabled.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Lbrlabs.PulumiPackage.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        // Create user at account level
        var example = new Harness.Platform.User("example", new()
        {
            Email = "john.doe@harness.io",
            RoleBindings = new[]
            {
                new Harness.Platform.Inputs.UserRoleBindingArgs
                {
                    ManagedRole = true,
                    ResourceGroupIdentifier = "_all_project_level_resources",
                    ResourceGroupName = "All Project Level Resources",
                    RoleIdentifier = "_project_viewer",
                    RoleName = "Project Viewer",
                },
            },
            UserGroups = new[]
            {
                "_project_all_users",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness/platform"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := platform.NewUser(ctx, "example", &platform.UserArgs{
    			Email: pulumi.String("john.doe@harness.io"),
    			RoleBindings: platform.UserRoleBindingArray{
    				&platform.UserRoleBindingArgs{
    					ManagedRole:             pulumi.Bool(true),
    					ResourceGroupIdentifier: pulumi.String("_all_project_level_resources"),
    					ResourceGroupName:       pulumi.String("All Project Level Resources"),
    					RoleIdentifier:          pulumi.String("_project_viewer"),
    					RoleName:                pulumi.String("Project Viewer"),
    				},
    			},
    			UserGroups: pulumi.StringArray{
    				pulumi.String("_project_all_users"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.platform.User;
    import com.pulumi.harness.platform.UserArgs;
    import com.pulumi.harness.platform.inputs.UserRoleBindingArgs;
    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()        
                .email("john.doe@harness.io")
                .roleBindings(UserRoleBindingArgs.builder()
                    .managedRole(true)
                    .resourceGroupIdentifier("_all_project_level_resources")
                    .resourceGroupName("All Project Level Resources")
                    .roleIdentifier("_project_viewer")
                    .roleName("Project Viewer")
                    .build())
                .userGroups("_project_all_users")
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    
    # Create user at account level
    example = harness.platform.User("example",
        email="john.doe@harness.io",
        role_bindings=[harness.platform.UserRoleBindingArgs(
            managed_role=True,
            resource_group_identifier="_all_project_level_resources",
            resource_group_name="All Project Level Resources",
            role_identifier="_project_viewer",
            role_name="Project Viewer",
        )],
        user_groups=["_project_all_users"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@lbrlabs/pulumi-harness";
    
    // Create user at account level
    const example = new harness.platform.User("example", {
        email: "john.doe@harness.io",
        roleBindings: [{
            managedRole: true,
            resourceGroupIdentifier: "_all_project_level_resources",
            resourceGroupName: "All Project Level Resources",
            roleIdentifier: "_project_viewer",
            roleName: "Project Viewer",
        }],
        userGroups: ["_project_all_users"],
    });
    
    resources:
      # Create user at account level
      example:
        type: harness:platform:User
        properties:
          email: john.doe@harness.io
          roleBindings:
            - managedRole: true
              resourceGroupIdentifier: _all_project_level_resources
              resourceGroupName: All Project Level Resources
              roleIdentifier: _project_viewer
              roleName: Project Viewer
          userGroups:
            - _project_all_users
    

    Create User Resource

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

    Constructor syntax

    new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
    @overload
    def User(resource_name: str,
             args: UserArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def User(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             email: Optional[str] = None,
             user_groups: Optional[Sequence[str]] = None,
             org_id: Optional[str] = None,
             project_id: Optional[str] = None,
             role_bindings: Optional[Sequence[UserRoleBindingArgs]] = None)
    func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
    public User(string name, UserArgs args, CustomResourceOptions? opts = null)
    public User(String name, UserArgs args)
    public User(String name, UserArgs args, CustomResourceOptions options)
    
    type: harness:platform:User
    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 UserArgs
    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 UserArgs
    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 UserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var harnessUserResource = new Harness.Platform.User("harnessUserResource", new()
    {
        Email = "string",
        UserGroups = new[]
        {
            "string",
        },
        OrgId = "string",
        ProjectId = "string",
        RoleBindings = new[]
        {
            new Harness.Platform.Inputs.UserRoleBindingArgs
            {
                ManagedRole = false,
                ResourceGroupIdentifier = "string",
                ResourceGroupName = "string",
                RoleIdentifier = "string",
                RoleName = "string",
            },
        },
    });
    
    example, err := platform.NewUser(ctx, "harnessUserResource", &platform.UserArgs{
    	Email: pulumi.String("string"),
    	UserGroups: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	OrgId:     pulumi.String("string"),
    	ProjectId: pulumi.String("string"),
    	RoleBindings: platform.UserRoleBindingArray{
    		&platform.UserRoleBindingArgs{
    			ManagedRole:             pulumi.Bool(false),
    			ResourceGroupIdentifier: pulumi.String("string"),
    			ResourceGroupName:       pulumi.String("string"),
    			RoleIdentifier:          pulumi.String("string"),
    			RoleName:                pulumi.String("string"),
    		},
    	},
    })
    
    var harnessUserResource = new User("harnessUserResource", UserArgs.builder()        
        .email("string")
        .userGroups("string")
        .orgId("string")
        .projectId("string")
        .roleBindings(UserRoleBindingArgs.builder()
            .managedRole(false)
            .resourceGroupIdentifier("string")
            .resourceGroupName("string")
            .roleIdentifier("string")
            .roleName("string")
            .build())
        .build());
    
    harness_user_resource = harness.platform.User("harnessUserResource",
        email="string",
        user_groups=["string"],
        org_id="string",
        project_id="string",
        role_bindings=[harness.platform.UserRoleBindingArgs(
            managed_role=False,
            resource_group_identifier="string",
            resource_group_name="string",
            role_identifier="string",
            role_name="string",
        )])
    
    const harnessUserResource = new harness.platform.User("harnessUserResource", {
        email: "string",
        userGroups: ["string"],
        orgId: "string",
        projectId: "string",
        roleBindings: [{
            managedRole: false,
            resourceGroupIdentifier: "string",
            resourceGroupName: "string",
            roleIdentifier: "string",
            roleName: "string",
        }],
    });
    
    type: harness:platform:User
    properties:
        email: string
        orgId: string
        projectId: string
        roleBindings:
            - managedRole: false
              resourceGroupIdentifier: string
              resourceGroupName: string
              roleIdentifier: string
              roleName: string
        userGroups:
            - string
    

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

    Email string
    The email of the user.
    UserGroups List<string>
    The user group of the user. Cannot be updated.
    OrgId string
    Organization identifier of the user.
    ProjectId string
    Project identifier of the user.
    RoleBindings List<Lbrlabs.PulumiPackage.Harness.Platform.Inputs.UserRoleBinding>
    Role Bindings of the user. Cannot be updated.
    Email string
    The email of the user.
    UserGroups []string
    The user group of the user. Cannot be updated.
    OrgId string
    Organization identifier of the user.
    ProjectId string
    Project identifier of the user.
    RoleBindings []UserRoleBindingArgs
    Role Bindings of the user. Cannot be updated.
    email String
    The email of the user.
    userGroups List<String>
    The user group of the user. Cannot be updated.
    orgId String
    Organization identifier of the user.
    projectId String
    Project identifier of the user.
    roleBindings List<UserRoleBinding>
    Role Bindings of the user. Cannot be updated.
    email string
    The email of the user.
    userGroups string[]
    The user group of the user. Cannot be updated.
    orgId string
    Organization identifier of the user.
    projectId string
    Project identifier of the user.
    roleBindings UserRoleBinding[]
    Role Bindings of the user. Cannot be updated.
    email str
    The email of the user.
    user_groups Sequence[str]
    The user group of the user. Cannot be updated.
    org_id str
    Organization identifier of the user.
    project_id str
    Project identifier of the user.
    role_bindings Sequence[UserRoleBindingArgs]
    Role Bindings of the user. Cannot be updated.
    email String
    The email of the user.
    userGroups List<String>
    The user group of the user. Cannot be updated.
    orgId String
    Organization identifier of the user.
    projectId String
    Project identifier of the user.
    roleBindings List<Property Map>
    Role Bindings of the user. Cannot be updated.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:

    Disabled bool
    Whether or not the user account is disabled.
    ExternallyManaged bool
    Whether or not the user account is externally managed.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identifier string
    Unique identifier of the user.
    Locked bool
    Whether or not the user account is locked.
    Name string
    Name of the user.
    Disabled bool
    Whether or not the user account is disabled.
    ExternallyManaged bool
    Whether or not the user account is externally managed.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identifier string
    Unique identifier of the user.
    Locked bool
    Whether or not the user account is locked.
    Name string
    Name of the user.
    disabled Boolean
    Whether or not the user account is disabled.
    externallyManaged Boolean
    Whether or not the user account is externally managed.
    id String
    The provider-assigned unique ID for this managed resource.
    identifier String
    Unique identifier of the user.
    locked Boolean
    Whether or not the user account is locked.
    name String
    Name of the user.
    disabled boolean
    Whether or not the user account is disabled.
    externallyManaged boolean
    Whether or not the user account is externally managed.
    id string
    The provider-assigned unique ID for this managed resource.
    identifier string
    Unique identifier of the user.
    locked boolean
    Whether or not the user account is locked.
    name string
    Name of the user.
    disabled bool
    Whether or not the user account is disabled.
    externally_managed bool
    Whether or not the user account is externally managed.
    id str
    The provider-assigned unique ID for this managed resource.
    identifier str
    Unique identifier of the user.
    locked bool
    Whether or not the user account is locked.
    name str
    Name of the user.
    disabled Boolean
    Whether or not the user account is disabled.
    externallyManaged Boolean
    Whether or not the user account is externally managed.
    id String
    The provider-assigned unique ID for this managed resource.
    identifier String
    Unique identifier of the user.
    locked Boolean
    Whether or not the user account is locked.
    name String
    Name of the user.

    Look up Existing User Resource

    Get an existing User 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?: UserState, opts?: CustomResourceOptions): User
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            disabled: Optional[bool] = None,
            email: Optional[str] = None,
            externally_managed: Optional[bool] = None,
            identifier: Optional[str] = None,
            locked: Optional[bool] = None,
            name: Optional[str] = None,
            org_id: Optional[str] = None,
            project_id: Optional[str] = None,
            role_bindings: Optional[Sequence[UserRoleBindingArgs]] = None,
            user_groups: Optional[Sequence[str]] = None) -> User
    func GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)
    public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)
    public static User get(String name, Output<String> id, UserState 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:
    Disabled bool
    Whether or not the user account is disabled.
    Email string
    The email of the user.
    ExternallyManaged bool
    Whether or not the user account is externally managed.
    Identifier string
    Unique identifier of the user.
    Locked bool
    Whether or not the user account is locked.
    Name string
    Name of the user.
    OrgId string
    Organization identifier of the user.
    ProjectId string
    Project identifier of the user.
    RoleBindings List<Lbrlabs.PulumiPackage.Harness.Platform.Inputs.UserRoleBinding>
    Role Bindings of the user. Cannot be updated.
    UserGroups List<string>
    The user group of the user. Cannot be updated.
    Disabled bool
    Whether or not the user account is disabled.
    Email string
    The email of the user.
    ExternallyManaged bool
    Whether or not the user account is externally managed.
    Identifier string
    Unique identifier of the user.
    Locked bool
    Whether or not the user account is locked.
    Name string
    Name of the user.
    OrgId string
    Organization identifier of the user.
    ProjectId string
    Project identifier of the user.
    RoleBindings []UserRoleBindingArgs
    Role Bindings of the user. Cannot be updated.
    UserGroups []string
    The user group of the user. Cannot be updated.
    disabled Boolean
    Whether or not the user account is disabled.
    email String
    The email of the user.
    externallyManaged Boolean
    Whether or not the user account is externally managed.
    identifier String
    Unique identifier of the user.
    locked Boolean
    Whether or not the user account is locked.
    name String
    Name of the user.
    orgId String
    Organization identifier of the user.
    projectId String
    Project identifier of the user.
    roleBindings List<UserRoleBinding>
    Role Bindings of the user. Cannot be updated.
    userGroups List<String>
    The user group of the user. Cannot be updated.
    disabled boolean
    Whether or not the user account is disabled.
    email string
    The email of the user.
    externallyManaged boolean
    Whether or not the user account is externally managed.
    identifier string
    Unique identifier of the user.
    locked boolean
    Whether or not the user account is locked.
    name string
    Name of the user.
    orgId string
    Organization identifier of the user.
    projectId string
    Project identifier of the user.
    roleBindings UserRoleBinding[]
    Role Bindings of the user. Cannot be updated.
    userGroups string[]
    The user group of the user. Cannot be updated.
    disabled bool
    Whether or not the user account is disabled.
    email str
    The email of the user.
    externally_managed bool
    Whether or not the user account is externally managed.
    identifier str
    Unique identifier of the user.
    locked bool
    Whether or not the user account is locked.
    name str
    Name of the user.
    org_id str
    Organization identifier of the user.
    project_id str
    Project identifier of the user.
    role_bindings Sequence[UserRoleBindingArgs]
    Role Bindings of the user. Cannot be updated.
    user_groups Sequence[str]
    The user group of the user. Cannot be updated.
    disabled Boolean
    Whether or not the user account is disabled.
    email String
    The email of the user.
    externallyManaged Boolean
    Whether or not the user account is externally managed.
    identifier String
    Unique identifier of the user.
    locked Boolean
    Whether or not the user account is locked.
    name String
    Name of the user.
    orgId String
    Organization identifier of the user.
    projectId String
    Project identifier of the user.
    roleBindings List<Property Map>
    Role Bindings of the user. Cannot be updated.
    userGroups List<String>
    The user group of the user. Cannot be updated.

    Supporting Types

    UserRoleBinding, UserRoleBindingArgs

    ManagedRole bool
    Managed Role of the user.
    ResourceGroupIdentifier string
    Resource Group Identifier of the user.
    ResourceGroupName string
    Resource Group Name of the user.
    RoleIdentifier string
    Role Identifier of the user.
    RoleName string
    Role Name Identifier of the user.
    ManagedRole bool
    Managed Role of the user.
    ResourceGroupIdentifier string
    Resource Group Identifier of the user.
    ResourceGroupName string
    Resource Group Name of the user.
    RoleIdentifier string
    Role Identifier of the user.
    RoleName string
    Role Name Identifier of the user.
    managedRole Boolean
    Managed Role of the user.
    resourceGroupIdentifier String
    Resource Group Identifier of the user.
    resourceGroupName String
    Resource Group Name of the user.
    roleIdentifier String
    Role Identifier of the user.
    roleName String
    Role Name Identifier of the user.
    managedRole boolean
    Managed Role of the user.
    resourceGroupIdentifier string
    Resource Group Identifier of the user.
    resourceGroupName string
    Resource Group Name of the user.
    roleIdentifier string
    Role Identifier of the user.
    roleName string
    Role Name Identifier of the user.
    managed_role bool
    Managed Role of the user.
    resource_group_identifier str
    Resource Group Identifier of the user.
    resource_group_name str
    Resource Group Name of the user.
    role_identifier str
    Role Identifier of the user.
    role_name str
    Role Name Identifier of the user.
    managedRole Boolean
    Managed Role of the user.
    resourceGroupIdentifier String
    Resource Group Identifier of the user.
    resourceGroupName String
    Resource Group Name of the user.
    roleIdentifier String
    Role Identifier of the user.
    roleName String
    Role Name Identifier of the user.

    Import

    Import account level

     $ pulumi import harness:platform/user:User john_doe <email_id>
    

    Import org level

     $ pulumi import harness:platform/user:User john_doe <email_id>/<org_id>
    

    Import project level

     $ pulumi import harness:platform/user:User john_doe <email_id>/<org_id>/<project_id>
    

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

    Package Details

    Repository
    harness lbrlabs/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs