vSphere v4.13.1 published on Wednesday, Feb 5, 2025 by Pulumi
vsphere.getRole
Explore with Pulumi AI
The vsphere.Role data source can be used to discover the id and privileges
associated with a role given its name or display label.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const terraformRole = vsphere.getRole({
    label: "Terraform to vSphere Integration Role",
});
import pulumi
import pulumi_vsphere as vsphere
terraform_role = vsphere.get_role(label="Terraform to vSphere Integration Role")
package main
import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vsphere.LookupRole(ctx, &vsphere.LookupRoleArgs{
			Label: "Terraform to vSphere Integration Role",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;
return await Deployment.RunAsync(() => 
{
    var terraformRole = VSphere.GetRole.Invoke(new()
    {
        Label = "Terraform to vSphere Integration Role",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetRoleArgs;
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) {
        final var terraformRole = VsphereFunctions.getRole(GetRoleArgs.builder()
            .label("Terraform to vSphere Integration Role")
            .build());
    }
}
variables:
  terraformRole:
    fn::invoke:
      function: vsphere:getRole
      arguments:
        label: Terraform to vSphere Integration Role
Using getRole
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>def get_role(description: Optional[str] = None,
             label: Optional[str] = None,
             name: Optional[str] = None,
             role_privileges: Optional[Sequence[str]] = None,
             opts: Optional[InvokeOptions] = None) -> GetRoleResult
def get_role_output(description: Optional[pulumi.Input[str]] = None,
             label: Optional[pulumi.Input[str]] = None,
             name: Optional[pulumi.Input[str]] = None,
             role_privileges: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput> Note: This function is named LookupRole in the Go SDK.
public static class GetRole 
{
    public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
    public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
public static Output<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
fn::invoke:
  function: vsphere:index/getRole:getRole
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Label string
 - The label of the role.
 - Description string
 - The description of the role.
 - Name string
 - Role
Privileges List<string> - The privileges associated with the role.
 
- Label string
 - The label of the role.
 - Description string
 - The description of the role.
 - Name string
 - Role
Privileges []string - The privileges associated with the role.
 
- label String
 - The label of the role.
 - description String
 - The description of the role.
 - name String
 - role
Privileges List<String> - The privileges associated with the role.
 
- label string
 - The label of the role.
 - description string
 - The description of the role.
 - name string
 - role
Privileges string[] - The privileges associated with the role.
 
- label str
 - The label of the role.
 - description str
 - The description of the role.
 - name str
 - role_
privileges Sequence[str] - The privileges associated with the role.
 
- label String
 - The label of the role.
 - description String
 - The description of the role.
 - name String
 - role
Privileges List<String> - The privileges associated with the role.
 
getRole Result
The following output properties are available:
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Label string
 - The display label of the role.
 - Description string
 - The description of the role.
 - Name string
 - Role
Privileges List<string> - The privileges associated with the role.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Label string
 - The display label of the role.
 - Description string
 - The description of the role.
 - Name string
 - Role
Privileges []string - The privileges associated with the role.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - label String
 - The display label of the role.
 - description String
 - The description of the role.
 - name String
 - role
Privileges List<String> - The privileges associated with the role.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - label string
 - The display label of the role.
 - description string
 - The description of the role.
 - name string
 - role
Privileges string[] - The privileges associated with the role.
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - label str
 - The display label of the role.
 - description str
 - The description of the role.
 - name str
 - role_
privileges Sequence[str] - The privileges associated with the role.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - label String
 - The display label of the role.
 - description String
 - The description of the role.
 - name String
 - role
Privileges List<String> - The privileges associated with the role.
 
Package Details
- Repository
 - vSphere pulumi/pulumi-vsphere
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
vsphereTerraform Provider.