1. Packages
  2. Vsphere Provider
  3. API Docs
  4. EntityPermissions
Viewing docs for vSphere v4.16.3
published on Thursday, Feb 26, 2026 by Pulumi
vsphere logo
Viewing docs for vSphere v4.16.3
published on Thursday, Feb 26, 2026 by Pulumi

    The vsphere.EntityPermissions resource can be used to create and manage entity permissions. Permissions can be created on an entity for a given user or group with the specified role.

    Example Usage

    This example creates entity permissions on the virtual machine VM1 for the user group DCClients with role Datastore consumer and for user group ExternalIDPUsers with role my_terraform_role. The entity_id can be the managed object id (or uuid for some resources). The entity_type is one of the managed object types which can be found from the managed object types section here. Keep the permissions sorted alphabetically, ignoring case on user_or_group for a better user experience.

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const datacenter = vsphere.getDatacenter({
        name: "Sample_DC_2",
    });
    const vm = datacenter.then(datacenter => vsphere.getVirtualMachine({
        name: "VM1",
        datacenterId: datacenter.id,
    }));
    const role1 = vsphere.getRole({
        label: "Datastore consumer (sample)",
    });
    const role2 = new vsphere.Role("role2", {
        name: "my_terraform_role",
        rolePrivileges: [
            "Alarm.Acknowledge",
            "Alarm.Create",
            "Datacenter.Move",
        ],
    });
    const p1 = new vsphere.EntityPermissions("p1", {
        entityId: vm.then(vm => vm.id),
        entityType: "VirtualMachine",
        permissions: [
            {
                userOrGroup: "vsphere.local\\DCClients",
                propagate: true,
                isGroup: true,
                roleId: role1.then(role1 => role1.id),
            },
            {
                userOrGroup: "vsphere.local\\ExternalIDPUsers",
                propagate: true,
                isGroup: true,
                roleId: role2.id,
            },
        ],
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="Sample_DC_2")
    vm = vsphere.get_virtual_machine(name="VM1",
        datacenter_id=datacenter.id)
    role1 = vsphere.get_role(label="Datastore consumer (sample)")
    role2 = vsphere.Role("role2",
        name="my_terraform_role",
        role_privileges=[
            "Alarm.Acknowledge",
            "Alarm.Create",
            "Datacenter.Move",
        ])
    p1 = vsphere.EntityPermissions("p1",
        entity_id=vm.id,
        entity_type="VirtualMachine",
        permissions=[
            {
                "user_or_group": "vsphere.local\\DCClients",
                "propagate": True,
                "is_group": True,
                "role_id": role1.id,
            },
            {
                "user_or_group": "vsphere.local\\ExternalIDPUsers",
                "propagate": True,
                "is_group": True,
                "role_id": role2.id,
            },
        ])
    
    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 {
    		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
    			Name: pulumi.StringRef("Sample_DC_2"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vm, err := vsphere.LookupVirtualMachine(ctx, &vsphere.LookupVirtualMachineArgs{
    			Name:         pulumi.StringRef("VM1"),
    			DatacenterId: pulumi.StringRef(datacenter.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		role1, err := vsphere.LookupRole(ctx, &vsphere.LookupRoleArgs{
    			Label: "Datastore consumer (sample)",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		role2, err := vsphere.NewRole(ctx, "role2", &vsphere.RoleArgs{
    			Name: pulumi.String("my_terraform_role"),
    			RolePrivileges: pulumi.StringArray{
    				pulumi.String("Alarm.Acknowledge"),
    				pulumi.String("Alarm.Create"),
    				pulumi.String("Datacenter.Move"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.NewEntityPermissions(ctx, "p1", &vsphere.EntityPermissionsArgs{
    			EntityId:   pulumi.String(vm.Id),
    			EntityType: pulumi.String("VirtualMachine"),
    			Permissions: vsphere.EntityPermissionsPermissionArray{
    				&vsphere.EntityPermissionsPermissionArgs{
    					UserOrGroup: pulumi.String("vsphere.local\\DCClients"),
    					Propagate:   pulumi.Bool(true),
    					IsGroup:     pulumi.Bool(true),
    					RoleId:      pulumi.String(role1.Id),
    				},
    				&vsphere.EntityPermissionsPermissionArgs{
    					UserOrGroup: pulumi.String("vsphere.local\\ExternalIDPUsers"),
    					Propagate:   pulumi.Bool(true),
    					IsGroup:     pulumi.Bool(true),
    					RoleId:      role2.ID(),
    				},
    			},
    		})
    		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 datacenter = VSphere.GetDatacenter.Invoke(new()
        {
            Name = "Sample_DC_2",
        });
    
        var vm = VSphere.GetVirtualMachine.Invoke(new()
        {
            Name = "VM1",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
        var role1 = VSphere.GetRole.Invoke(new()
        {
            Label = "Datastore consumer (sample)",
        });
    
        var role2 = new VSphere.Role("role2", new()
        {
            Name = "my_terraform_role",
            RolePrivileges = new[]
            {
                "Alarm.Acknowledge",
                "Alarm.Create",
                "Datacenter.Move",
            },
        });
    
        var p1 = new VSphere.EntityPermissions("p1", new()
        {
            EntityId = vm.Apply(getVirtualMachineResult => getVirtualMachineResult.Id),
            EntityType = "VirtualMachine",
            Permissions = new[]
            {
                new VSphere.Inputs.EntityPermissionsPermissionArgs
                {
                    UserOrGroup = "vsphere.local\\DCClients",
                    Propagate = true,
                    IsGroup = true,
                    RoleId = role1.Apply(getRoleResult => getRoleResult.Id),
                },
                new VSphere.Inputs.EntityPermissionsPermissionArgs
                {
                    UserOrGroup = "vsphere.local\\ExternalIDPUsers",
                    Propagate = true,
                    IsGroup = true,
                    RoleId = role2.Id,
                },
            },
        });
    
    });
    
    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.GetDatacenterArgs;
    import com.pulumi.vsphere.inputs.GetVirtualMachineArgs;
    import com.pulumi.vsphere.inputs.GetRoleArgs;
    import com.pulumi.vsphere.Role;
    import com.pulumi.vsphere.RoleArgs;
    import com.pulumi.vsphere.EntityPermissions;
    import com.pulumi.vsphere.EntityPermissionsArgs;
    import com.pulumi.vsphere.inputs.EntityPermissionsPermissionArgs;
    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 datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("Sample_DC_2")
                .build());
    
            final var vm = VsphereFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
                .name("VM1")
                .datacenterId(datacenter.id())
                .build());
    
            final var role1 = VsphereFunctions.getRole(GetRoleArgs.builder()
                .label("Datastore consumer (sample)")
                .build());
    
            var role2 = new Role("role2", RoleArgs.builder()
                .name("my_terraform_role")
                .rolePrivileges(            
                    "Alarm.Acknowledge",
                    "Alarm.Create",
                    "Datacenter.Move")
                .build());
    
            var p1 = new EntityPermissions("p1", EntityPermissionsArgs.builder()
                .entityId(vm.id())
                .entityType("VirtualMachine")
                .permissions(            
                    EntityPermissionsPermissionArgs.builder()
                        .userOrGroup("vsphere.local\\DCClients")
                        .propagate(true)
                        .isGroup(true)
                        .roleId(role1.id())
                        .build(),
                    EntityPermissionsPermissionArgs.builder()
                        .userOrGroup("vsphere.local\\ExternalIDPUsers")
                        .propagate(true)
                        .isGroup(true)
                        .roleId(role2.id())
                        .build())
                .build());
    
        }
    }
    
    resources:
      role2:
        type: vsphere:Role
        properties:
          name: my_terraform_role
          rolePrivileges:
            - Alarm.Acknowledge
            - Alarm.Create
            - Datacenter.Move
      p1:
        type: vsphere:EntityPermissions
        properties:
          entityId: ${vm.id}
          entityType: VirtualMachine
          permissions:
            - userOrGroup: vsphere.local\DCClients
              propagate: true
              isGroup: true
              roleId: ${role1.id}
            - userOrGroup: vsphere.local\ExternalIDPUsers
              propagate: true
              isGroup: true
              roleId: ${role2.id}
    variables:
      datacenter:
        fn::invoke:
          function: vsphere:getDatacenter
          arguments:
            name: Sample_DC_2
      vm:
        fn::invoke:
          function: vsphere:getVirtualMachine
          arguments:
            name: VM1
            datacenterId: ${datacenter.id}
      role1:
        fn::invoke:
          function: vsphere:getRole
          arguments:
            label: Datastore consumer (sample)
    

    Create EntityPermissions Resource

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

    Constructor syntax

    new EntityPermissions(name: string, args: EntityPermissionsArgs, opts?: CustomResourceOptions);
    @overload
    def EntityPermissions(resource_name: str,
                          args: EntityPermissionsArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def EntityPermissions(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          entity_id: Optional[str] = None,
                          entity_type: Optional[str] = None,
                          permissions: Optional[Sequence[EntityPermissionsPermissionArgs]] = None)
    func NewEntityPermissions(ctx *Context, name string, args EntityPermissionsArgs, opts ...ResourceOption) (*EntityPermissions, error)
    public EntityPermissions(string name, EntityPermissionsArgs args, CustomResourceOptions? opts = null)
    public EntityPermissions(String name, EntityPermissionsArgs args)
    public EntityPermissions(String name, EntityPermissionsArgs args, CustomResourceOptions options)
    
    type: vsphere:EntityPermissions
    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 EntityPermissionsArgs
    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 EntityPermissionsArgs
    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 EntityPermissionsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EntityPermissionsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EntityPermissionsArgs
    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 entityPermissionsResource = new VSphere.EntityPermissions("entityPermissionsResource", new()
    {
        EntityId = "string",
        EntityType = "string",
        Permissions = new[]
        {
            new VSphere.Inputs.EntityPermissionsPermissionArgs
            {
                IsGroup = false,
                Propagate = false,
                RoleId = "string",
                UserOrGroup = "string",
            },
        },
    });
    
    example, err := vsphere.NewEntityPermissions(ctx, "entityPermissionsResource", &vsphere.EntityPermissionsArgs{
    	EntityId:   pulumi.String("string"),
    	EntityType: pulumi.String("string"),
    	Permissions: vsphere.EntityPermissionsPermissionArray{
    		&vsphere.EntityPermissionsPermissionArgs{
    			IsGroup:     pulumi.Bool(false),
    			Propagate:   pulumi.Bool(false),
    			RoleId:      pulumi.String("string"),
    			UserOrGroup: pulumi.String("string"),
    		},
    	},
    })
    
    var entityPermissionsResource = new EntityPermissions("entityPermissionsResource", EntityPermissionsArgs.builder()
        .entityId("string")
        .entityType("string")
        .permissions(EntityPermissionsPermissionArgs.builder()
            .isGroup(false)
            .propagate(false)
            .roleId("string")
            .userOrGroup("string")
            .build())
        .build());
    
    entity_permissions_resource = vsphere.EntityPermissions("entityPermissionsResource",
        entity_id="string",
        entity_type="string",
        permissions=[{
            "is_group": False,
            "propagate": False,
            "role_id": "string",
            "user_or_group": "string",
        }])
    
    const entityPermissionsResource = new vsphere.EntityPermissions("entityPermissionsResource", {
        entityId: "string",
        entityType: "string",
        permissions: [{
            isGroup: false,
            propagate: false,
            roleId: "string",
            userOrGroup: "string",
        }],
    });
    
    type: vsphere:EntityPermissions
    properties:
        entityId: string
        entityType: string
        permissions:
            - isGroup: false
              propagate: false
              roleId: string
              userOrGroup: string
    

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

    EntityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    EntityType string
    The managed object type, types can be found in the managed object type section here.
    Permissions List<Pulumi.VSphere.Inputs.EntityPermissionsPermission>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    EntityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    EntityType string
    The managed object type, types can be found in the managed object type section here.
    Permissions []EntityPermissionsPermissionArgs
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId String
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType String
    The managed object type, types can be found in the managed object type section here.
    permissions List<EntityPermissionsPermission>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType string
    The managed object type, types can be found in the managed object type section here.
    permissions EntityPermissionsPermission[]
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entity_id str
    The managed object id (uuid for some entities) on which permissions are to be created.
    entity_type str
    The managed object type, types can be found in the managed object type section here.
    permissions Sequence[EntityPermissionsPermissionArgs]
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId String
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType String
    The managed object type, types can be found in the managed object type section here.
    permissions List<Property Map>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.

    Outputs

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

    Get an existing EntityPermissions 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?: EntityPermissionsState, opts?: CustomResourceOptions): EntityPermissions
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            entity_id: Optional[str] = None,
            entity_type: Optional[str] = None,
            permissions: Optional[Sequence[EntityPermissionsPermissionArgs]] = None) -> EntityPermissions
    func GetEntityPermissions(ctx *Context, name string, id IDInput, state *EntityPermissionsState, opts ...ResourceOption) (*EntityPermissions, error)
    public static EntityPermissions Get(string name, Input<string> id, EntityPermissionsState? state, CustomResourceOptions? opts = null)
    public static EntityPermissions get(String name, Output<String> id, EntityPermissionsState state, CustomResourceOptions options)
    resources:  _:    type: vsphere:EntityPermissions    get:      id: ${id}
    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:
    EntityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    EntityType string
    The managed object type, types can be found in the managed object type section here.
    Permissions List<Pulumi.VSphere.Inputs.EntityPermissionsPermission>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    EntityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    EntityType string
    The managed object type, types can be found in the managed object type section here.
    Permissions []EntityPermissionsPermissionArgs
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId String
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType String
    The managed object type, types can be found in the managed object type section here.
    permissions List<EntityPermissionsPermission>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId string
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType string
    The managed object type, types can be found in the managed object type section here.
    permissions EntityPermissionsPermission[]
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entity_id str
    The managed object id (uuid for some entities) on which permissions are to be created.
    entity_type str
    The managed object type, types can be found in the managed object type section here.
    permissions Sequence[EntityPermissionsPermissionArgs]
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.
    entityId String
    The managed object id (uuid for some entities) on which permissions are to be created.
    entityType String
    The managed object type, types can be found in the managed object type section here.
    permissions List<Property Map>
    The permissions to be given on this entity. Keep the permissions sorted alphabetically on user_or_group for a better user experience.

    Supporting Types

    EntityPermissionsPermission, EntityPermissionsPermissionArgs

    IsGroup bool
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    Propagate bool
    Whether or not this permission propagates down the hierarchy to sub-entities.
    RoleId string
    The role id of the role to be given to the user on the specified entity.
    UserOrGroup string
    The user/group getting the permission.
    IsGroup bool
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    Propagate bool
    Whether or not this permission propagates down the hierarchy to sub-entities.
    RoleId string
    The role id of the role to be given to the user on the specified entity.
    UserOrGroup string
    The user/group getting the permission.
    isGroup Boolean
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    propagate Boolean
    Whether or not this permission propagates down the hierarchy to sub-entities.
    roleId String
    The role id of the role to be given to the user on the specified entity.
    userOrGroup String
    The user/group getting the permission.
    isGroup boolean
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    propagate boolean
    Whether or not this permission propagates down the hierarchy to sub-entities.
    roleId string
    The role id of the role to be given to the user on the specified entity.
    userOrGroup string
    The user/group getting the permission.
    is_group bool
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    propagate bool
    Whether or not this permission propagates down the hierarchy to sub-entities.
    role_id str
    The role id of the role to be given to the user on the specified entity.
    user_or_group str
    The user/group getting the permission.
    isGroup Boolean
    Whether user_or_group field refers to a user or a group. True for a group and false for a user.
    propagate Boolean
    Whether or not this permission propagates down the hierarchy to sub-entities.
    roleId String
    The role id of the role to be given to the user on the specified entity.
    userOrGroup String
    The user/group getting the permission.

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    Viewing docs for vSphere v4.16.3
    published on Thursday, Feb 26, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.