harness.platform.User
Explore with Pulumi AI
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)
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.
Constructor 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.
- User
Groups List<string> - The user group of the user. Cannot be updated.
- Org
Id string - Organization identifier of the user.
- Project
Id string - Project identifier of the user.
- Role
Bindings List<Lbrlabs.Pulumi Package. Harness. Platform. Inputs. User Role Binding> - Role Bindings of the user. Cannot be updated.
- Email string
- The email of the user.
- User
Groups []string - The user group of the user. Cannot be updated.
- Org
Id string - Organization identifier of the user.
- Project
Id string - Project identifier of the user.
- Role
Bindings []UserRole Binding Args - Role Bindings of the user. Cannot be updated.
- email String
- The email of the user.
- user
Groups List<String> - The user group of the user. Cannot be updated.
- org
Id String - Organization identifier of the user.
- project
Id String - Project identifier of the user.
- role
Bindings List<UserRole Binding> - Role Bindings of the user. Cannot be updated.
- email string
- The email of the user.
- user
Groups string[] - The user group of the user. Cannot be updated.
- org
Id string - Organization identifier of the user.
- project
Id string - Project identifier of the user.
- role
Bindings UserRole Binding[] - 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[UserRole Binding Args] - Role Bindings of the user. Cannot be updated.
- email String
- The email of the user.
- user
Groups List<String> - The user group of the user. Cannot be updated.
- org
Id String - Organization identifier of the user.
- project
Id String - Project identifier of the user.
- role
Bindings 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.
- Externally
Managed 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.
- Externally
Managed 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.
- externally
Managed 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.
- externally
Managed 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.
- externally
Managed 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.
- Disabled bool
- Whether or not the user account is disabled.
- Email string
- The email of the user.
- Externally
Managed 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.
- Org
Id string - Organization identifier of the user.
- Project
Id string - Project identifier of the user.
- Role
Bindings List<Lbrlabs.Pulumi Package. Harness. Platform. Inputs. User Role Binding> - Role Bindings of the user. Cannot be updated.
- User
Groups 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.
- Externally
Managed 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.
- Org
Id string - Organization identifier of the user.
- Project
Id string - Project identifier of the user.
- Role
Bindings []UserRole Binding Args - Role Bindings of the user. Cannot be updated.
- User
Groups []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.
- externally
Managed 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.
- org
Id String - Organization identifier of the user.
- project
Id String - Project identifier of the user.
- role
Bindings List<UserRole Binding> - Role Bindings of the user. Cannot be updated.
- user
Groups 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.
- externally
Managed 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.
- org
Id string - Organization identifier of the user.
- project
Id string - Project identifier of the user.
- role
Bindings UserRole Binding[] - Role Bindings of the user. Cannot be updated.
- user
Groups 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[UserRole Binding Args] - 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.
- externally
Managed 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.
- org
Id String - Organization identifier of the user.
- project
Id String - Project identifier of the user.
- role
Bindings List<Property Map> - Role Bindings of the user. Cannot be updated.
- user
Groups List<String> - The user group of the user. Cannot be updated.
Supporting Types
UserRoleBinding, UserRoleBindingArgs
- Managed
Role bool - Managed Role of the user.
- Resource
Group stringIdentifier - Resource Group Identifier of the user.
- Resource
Group stringName - Resource Group Name of the user.
- Role
Identifier string - Role Identifier of the user.
- Role
Name string - Role Name Identifier of the user.
- Managed
Role bool - Managed Role of the user.
- Resource
Group stringIdentifier - Resource Group Identifier of the user.
- Resource
Group stringName - Resource Group Name of the user.
- Role
Identifier string - Role Identifier of the user.
- Role
Name string - Role Name Identifier of the user.
- managed
Role Boolean - Managed Role of the user.
- resource
Group StringIdentifier - Resource Group Identifier of the user.
- resource
Group StringName - Resource Group Name of the user.
- role
Identifier String - Role Identifier of the user.
- role
Name String - Role Name Identifier of the user.
- managed
Role boolean - Managed Role of the user.
- resource
Group stringIdentifier - Resource Group Identifier of the user.
- resource
Group stringName - Resource Group Name of the user.
- role
Identifier string - Role Identifier of the user.
- role
Name string - Role Name Identifier of the user.
- managed_
role bool - Managed Role of the user.
- resource_
group_ stridentifier - Resource Group Identifier of the user.
- resource_
group_ strname - Resource Group Name of the user.
- role_
identifier str - Role Identifier of the user.
- role_
name str - Role Name Identifier of the user.
- managed
Role Boolean - Managed Role of the user.
- resource
Group StringIdentifier - Resource Group Identifier of the user.
- resource
Group StringName - Resource Group Name of the user.
- role
Identifier String - Role Identifier of the user.
- role
Name 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.