1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. Roles
Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi

harness.platform.Roles

Explore with Pulumi AI

Example Usage

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

const example = new harness.platform.Roles("example", {
    identifier: "identifier",
    name: "name",
    description: "test",
    tags: ["foo:bar"],
    permissions: ["core_resourcegroup_view"],
    allowedScopeLevels: ["account"],
});
Copy
import pulumi
import pulumi_harness as harness

example = harness.platform.Roles("example",
    identifier="identifier",
    name="name",
    description="test",
    tags=["foo:bar"],
    permissions=["core_resourcegroup_view"],
    allowed_scope_levels=["account"])
Copy
package main

import (
	"github.com/pulumi/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.NewRoles(ctx, "example", &platform.RolesArgs{
			Identifier:  pulumi.String("identifier"),
			Name:        pulumi.String("name"),
			Description: pulumi.String("test"),
			Tags: pulumi.StringArray{
				pulumi.String("foo:bar"),
			},
			Permissions: pulumi.StringArray{
				pulumi.String("core_resourcegroup_view"),
			},
			AllowedScopeLevels: pulumi.StringArray{
				pulumi.String("account"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var example = new Harness.Platform.Roles("example", new()
    {
        Identifier = "identifier",
        Name = "name",
        Description = "test",
        Tags = new[]
        {
            "foo:bar",
        },
        Permissions = new[]
        {
            "core_resourcegroup_view",
        },
        AllowedScopeLevels = new[]
        {
            "account",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.Roles;
import com.pulumi.harness.platform.RolesArgs;
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 Roles("example", RolesArgs.builder()
            .identifier("identifier")
            .name("name")
            .description("test")
            .tags("foo:bar")
            .permissions("core_resourcegroup_view")
            .allowedScopeLevels("account")
            .build());

    }
}
Copy
resources:
  example:
    type: harness:platform:Roles
    properties:
      identifier: identifier
      name: name
      description: test
      tags:
        - foo:bar
      permissions:
        - core_resourcegroup_view
      allowedScopeLevels:
        - account
Copy

Create Roles Resource

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

Constructor syntax

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

@overload
def Roles(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          identifier: Optional[str] = None,
          allowed_scope_levels: Optional[Sequence[str]] = None,
          description: Optional[str] = None,
          name: Optional[str] = None,
          org_id: Optional[str] = None,
          permissions: Optional[Sequence[str]] = None,
          project_id: Optional[str] = None,
          tags: Optional[Sequence[str]] = None)
func NewRoles(ctx *Context, name string, args RolesArgs, opts ...ResourceOption) (*Roles, error)
public Roles(string name, RolesArgs args, CustomResourceOptions? opts = null)
public Roles(String name, RolesArgs args)
public Roles(String name, RolesArgs args, CustomResourceOptions options)
type: harness:platform:Roles
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. RolesArgs
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. RolesArgs
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. RolesArgs
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. RolesArgs
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. RolesArgs
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 rolesResource = new Harness.Platform.Roles("rolesResource", new()
{
    Identifier = "string",
    AllowedScopeLevels = new[]
    {
        "string",
    },
    Description = "string",
    Name = "string",
    OrgId = "string",
    Permissions = new[]
    {
        "string",
    },
    ProjectId = "string",
    Tags = new[]
    {
        "string",
    },
});
Copy
example, err := platform.NewRoles(ctx, "rolesResource", &platform.RolesArgs{
	Identifier: pulumi.String("string"),
	AllowedScopeLevels: pulumi.StringArray{
		pulumi.String("string"),
	},
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	OrgId:       pulumi.String("string"),
	Permissions: pulumi.StringArray{
		pulumi.String("string"),
	},
	ProjectId: pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var rolesResource = new Roles("rolesResource", RolesArgs.builder()
    .identifier("string")
    .allowedScopeLevels("string")
    .description("string")
    .name("string")
    .orgId("string")
    .permissions("string")
    .projectId("string")
    .tags("string")
    .build());
Copy
roles_resource = harness.platform.Roles("rolesResource",
    identifier="string",
    allowed_scope_levels=["string"],
    description="string",
    name="string",
    org_id="string",
    permissions=["string"],
    project_id="string",
    tags=["string"])
Copy
const rolesResource = new harness.platform.Roles("rolesResource", {
    identifier: "string",
    allowedScopeLevels: ["string"],
    description: "string",
    name: "string",
    orgId: "string",
    permissions: ["string"],
    projectId: "string",
    tags: ["string"],
});
Copy
type: harness:platform:Roles
properties:
    allowedScopeLevels:
        - string
    description: string
    identifier: string
    name: string
    orgId: string
    permissions:
        - string
    projectId: string
    tags:
        - string
Copy

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

Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
AllowedScopeLevels List<string>
The scope levels at which this role can be used
Description string
Description of the resource.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Permissions List<string>
List of the permission identifiers
ProjectId string
Unique identifier of the project.
Tags List<string>
Tags to associate with the resource.
Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
AllowedScopeLevels []string
The scope levels at which this role can be used
Description string
Description of the resource.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Permissions []string
List of the permission identifiers
ProjectId string
Unique identifier of the project.
Tags []string
Tags to associate with the resource.
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
allowedScopeLevels List<String>
The scope levels at which this role can be used
description String
Description of the resource.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
permissions List<String>
List of the permission identifiers
projectId String
Unique identifier of the project.
tags List<String>
Tags to associate with the resource.
identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
allowedScopeLevels string[]
The scope levels at which this role can be used
description string
Description of the resource.
name string
Name of the resource.
orgId string
Unique identifier of the organization.
permissions string[]
List of the permission identifiers
projectId string
Unique identifier of the project.
tags string[]
Tags to associate with the resource.
identifier
This property is required.
Changes to this property will trigger replacement.
str
Unique identifier of the resource.
allowed_scope_levels Sequence[str]
The scope levels at which this role can be used
description str
Description of the resource.
name str
Name of the resource.
org_id str
Unique identifier of the organization.
permissions Sequence[str]
List of the permission identifiers
project_id str
Unique identifier of the project.
tags Sequence[str]
Tags to associate with the resource.
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
allowedScopeLevels List<String>
The scope levels at which this role can be used
description String
Description of the resource.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
permissions List<String>
List of the permission identifiers
projectId String
Unique identifier of the project.
tags List<String>
Tags to associate with the resource.

Outputs

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

Get an existing Roles 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?: RolesState, opts?: CustomResourceOptions): Roles
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allowed_scope_levels: Optional[Sequence[str]] = None,
        description: Optional[str] = None,
        identifier: Optional[str] = None,
        name: Optional[str] = None,
        org_id: Optional[str] = None,
        permissions: Optional[Sequence[str]] = None,
        project_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None) -> Roles
func GetRoles(ctx *Context, name string, id IDInput, state *RolesState, opts ...ResourceOption) (*Roles, error)
public static Roles Get(string name, Input<string> id, RolesState? state, CustomResourceOptions? opts = null)
public static Roles get(String name, Output<String> id, RolesState state, CustomResourceOptions options)
resources:  _:    type: harness:platform:Roles    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:
AllowedScopeLevels List<string>
The scope levels at which this role can be used
Description string
Description of the resource.
Identifier Changes to this property will trigger replacement. string
Unique identifier of the resource.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Permissions List<string>
List of the permission identifiers
ProjectId string
Unique identifier of the project.
Tags List<string>
Tags to associate with the resource.
AllowedScopeLevels []string
The scope levels at which this role can be used
Description string
Description of the resource.
Identifier Changes to this property will trigger replacement. string
Unique identifier of the resource.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Permissions []string
List of the permission identifiers
ProjectId string
Unique identifier of the project.
Tags []string
Tags to associate with the resource.
allowedScopeLevels List<String>
The scope levels at which this role can be used
description String
Description of the resource.
identifier Changes to this property will trigger replacement. String
Unique identifier of the resource.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
permissions List<String>
List of the permission identifiers
projectId String
Unique identifier of the project.
tags List<String>
Tags to associate with the resource.
allowedScopeLevels string[]
The scope levels at which this role can be used
description string
Description of the resource.
identifier Changes to this property will trigger replacement. string
Unique identifier of the resource.
name string
Name of the resource.
orgId string
Unique identifier of the organization.
permissions string[]
List of the permission identifiers
projectId string
Unique identifier of the project.
tags string[]
Tags to associate with the resource.
allowed_scope_levels Sequence[str]
The scope levels at which this role can be used
description str
Description of the resource.
identifier Changes to this property will trigger replacement. str
Unique identifier of the resource.
name str
Name of the resource.
org_id str
Unique identifier of the organization.
permissions Sequence[str]
List of the permission identifiers
project_id str
Unique identifier of the project.
tags Sequence[str]
Tags to associate with the resource.
allowedScopeLevels List<String>
The scope levels at which this role can be used
description String
Description of the resource.
identifier Changes to this property will trigger replacement. String
Unique identifier of the resource.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
permissions List<String>
List of the permission identifiers
projectId String
Unique identifier of the project.
tags List<String>
Tags to associate with the resource.

Import

Import account level roles

$ pulumi import harness:platform/roles:Roles example <roles_id>
Copy

Import org level roles

$ pulumi import harness:platform/roles:Roles example <ord_id>/<roles_id>
Copy

Import project level roles

$ pulumi import harness:platform/roles:Roles example <org_id>/<project_id>/<roles_id>
Copy

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

Package Details

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