1. Packages
  2. Vsphere Provider
  3. API Docs
  4. getRole
vSphere v4.16.1 published on Wednesday, Oct 22, 2025 by Pulumi

vsphere.getRole

Start a Neo task
Explain and create a vsphere.getRole resource
vsphere logo
vSphere v4.16.1 published on Wednesday, Oct 22, 2025 by Pulumi

    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 dictionary

    The following arguments are supported:

    Label string
    The label of the role.
    Description string
    The description of the role.
    Name string
    RolePrivileges List<string>
    The privileges associated with the role.
    Label string
    The label of the role.
    Description string
    The description of the role.
    Name string
    RolePrivileges []string
    The privileges associated with the role.
    label String
    The label of the role.
    description String
    The description of the role.
    name String
    rolePrivileges List<String>
    The privileges associated with the role.
    label string
    The label of the role.
    description string
    The description of the role.
    name string
    rolePrivileges 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
    rolePrivileges 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
    RolePrivileges 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
    RolePrivileges []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
    rolePrivileges 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
    rolePrivileges 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
    rolePrivileges 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 vsphere Terraform Provider.
    vsphere logo
    vSphere v4.16.1 published on Wednesday, Oct 22, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate