Skip to content

azurermLabServiceLab

Manages a Lab Service Lab.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermLabServicesLabExample = new azurerm.labServicesLab.LabServicesLab(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-lab",
    resource_group_name: azurermResourceGroupExample.name,
    security: [
      {
        open_access_enabled: false,
      },
    ],
    title: "Test Title",
    virtual_machine: [
      {
        admin_user: [
          {
            password: "Password1234!",
            username: "testadmin",
          },
        ],
        image_reference: [
          {
            offer: "0001-com-ubuntu-server-focal",
            publisher: "canonical",
            sku: "20_04-lts",
            version: "latest",
          },
        ],
        sku: [
          {
            capacity: 0,
            name: "Classic_Fsv2_2_4GB_128_S_SSD",
          },
        ],
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLabServicesLabExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Lab Service Lab. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Lab Service Lab should exist. Changing this forces a new resource to be created.

  • location - (Required) The Azure Region where the Lab Service Lab should exist. Changing this forces a new resource to be created.

  • security - (Required) A security block as defined below.

  • title - (Required) The title of the Lab Service Lab.

  • virtualMachine - (Required) A virtualMachine block as defined below.

  • autoShutdown - (Optional) An autoShutdown block as defined below.

  • connectionSetting - (Optional) A connectionSetting block as defined below.

  • description - (Optional) The description of the Lab Service Lab.

  • labPlanId - (Optional) The resource ID of the Lab Plan that is used during resource creation to provide defaults and acts as a permission container when creating a Lab Service Lab via labsAzureCom.

  • network - (Optional) A network block as defined below.

  • roster - (Optional) A roster block as defined below.

  • tags - (Optional) A mapping of tags which should be assigned to the Lab Service Lab.


An autoShutdown block supports the following:

  • disconnectDelay - (Optional) The amount of time a VM will stay running after a user disconnects if this behavior is enabled. This value must be formatted as an ISO 8601 string.

\~> NOTE: The shutdownOnDisconnect is disabled when disconnectDelay isn't specified.

  • idleDelay - (Optional) The amount of time a VM will idle before it is shutdown if this behavior is enabled. This value must be formatted as an ISO 8601 string.

  • noConnectDelay - (Optional) The amount of time a VM will stay running before it is shutdown if no connection is made and this behavior is enabled. This value must be formatted as an ISO 8601 string.

\~> NOTE: The shutdownWhenNotConnected is disabled when noConnectDelay isn't specified.

  • shutdownOnIdle - (Optional) A VM will get shutdown when it has idled for a period of time. Possible values are lowUsage and userAbsence.

\~> NOTE: This property is none when it isn't specified. No need to set idleDelay when shutdownOnIdle isn't specified.


A connectionSetting block supports the following:

  • clientRdpAccess - (Optional) The enabled access level for Client Access over RDP. Possible value is public.

\~> NOTE: This property is none when it isn't specified.

  • clientSshAccess - (Optional) The enabled access level for Client Access over SSH. Possible value is public.

\~> NOTE: This property is none when it isn't specified.


A security block supports the following:

  • openAccessEnabled - (Required) Is open access enabled to allow any user or only specified users to register to a Lab Service Lab?

A virtualMachine block supports the following:

  • adminUser - (Required) An adminUser block as defined below.

  • imageReference - (Required) An imageReference block as defined below.

  • sku - (Required) A sku block as defined below.

  • additionalCapabilityGpuDriversInstalled - (Optional) Is flagged to pre-install dedicated GPU drivers? Defaults to false. Changing this forces a new resource to be created.

  • createOption - (Optional) The create option to indicate what Lab Service Lab VMs are created from. Possible values are image and templateVm. Defaults to image. Changing this forces a new resource to be created.

  • nonAdminUser - (Optional) A nonAdminUser block as defined below.

  • sharedPasswordEnabled - (Optional) Is the shared password enabled with the same password for all user VMs? Defaults to false. Changing this forces a new resource to be created.

  • usageQuota - (Optional) The initial quota allocated to each Lab Service Lab user. Defaults to pt0S. This value must be formatted as an ISO 8601 string.


An adminUser block supports the following:

  • username - (Required) The username to use when signing in to Lab Service Lab VMs. Changing this forces a new resource to be created.

  • password - (Required) The password for the Lab user. Changing this forces a new resource to be created.


An imageReference block supports the following:

  • id - (Optional) The resource ID of the image. Changing this forces a new resource to be created.

  • offer - (Optional) The image offer if applicable. Changing this forces a new resource to be created.

  • publisher - (Optional) The image publisher. Changing this forces a new resource to be created.

  • sku - (Optional) The image SKU. Changing this forces a new resource to be created.

  • version - (Optional) The image version specified on creation. Changing this forces a new resource to be created.


A nonAdminUser block supports the following:

  • username - (Required) The username to use when signing in to Lab Service Lab VMs.

  • password - (Required) The password for the user.


A sku block supports the following:

  • name - (Required) The name of the SKU. Changing this forces a new resource to be created.

  • capacity - (Required) The capacity for the SKU. Possible values are between 0 and 400.

\~> NOTE: Once activeDirectoryGroupId is enabled, capacity wouldn't take effect, and it would be automatically set to the number of members in AAD Group by service API. So it has to use ignoreChanges to avoid the difference of tf plan.


A network block supports the following:

  • subnetId - (Optional) The resource ID of the Subnet for the network profile of the Lab Service Lab.

A roster block supports the following:

  • activeDirectoryGroupId - (Optional) The AAD group ID which this Lab Service Lab roster is populated from.

  • lmsInstance - (Optional) The base URI identifying the lms instance.

  • ltiClientId - (Optional) The unique id of the Azure Lab Service tool in the lms.

  • ltiContextId - (Optional) The unique context identifier for the Lab Service Lab in the lms.

  • ltiRosterEndpoint - (Optional) The URI of the names and roles service endpoint on the lms for the class attached to this Lab Service Lab.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Lab Service Lab.

  • security - A security block as defined below.

  • network - A network block as defined below.


A security block supports the following:

  • registrationCode - The registration code for the Lab Service Lab.

A network block supports the following:

  • loadBalancerId - The resource ID of the Load Balancer for the network profile of the Lab Service Lab.

  • publicIpId - The resource ID of the Public IP for the network profile of the Lab Service Lab.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 90 minutes) Used when creating the Lab Service Lab.
  • read - (Defaults to 5 minutes) Used when retrieving the Lab Service Lab.
  • update - (Defaults to 90 minutes) Used when updating the Lab Service Lab.
  • delete - (Defaults to 90 minutes) Used when deleting the Lab Service Lab.

Import

Lab Service Labs can be imported using the resourceId, e.g.

terraform import azurerm_lab_service_lab.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.LabServices/labs/lab1