Skip to content

azurermMachineLearningComputeCluster

Manages a Machine Learning Compute Cluster. NOTE: At this point in time the resource cannot be updated (not supported by the backend Azure Go SDK). Therefore it can only be created and deleted, not updated. At the moment, there is also no possibility to specify ssh User Account Credentials to ssh into the compute cluster.

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-rg",
    tags: {
      stage: "example",
    },
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplesa",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_2",
  {
    address_space: ["10.1.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const dataAzurermClientConfigCurrent =
  new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
    this,
    "current",
    {}
  );
const azurermApplicationInsightsExample =
  new azurerm.applicationInsights.ApplicationInsights(this, "example_4", {
    application_type: "web",
    location: azurermResourceGroupExample.location,
    name: "example-ai",
    resource_group_name: azurermResourceGroupExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApplicationInsightsExample.overrideLogicalId("example");
const azurermKeyVaultExample = new azurerm.keyVault.KeyVault(
  this,
  "example_5",
  {
    location: azurermResourceGroupExample.location,
    name: "example-kv",
    purge_protection_enabled: true,
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "standard",
    tenant_id: dataAzurermClientConfigCurrent.tenantId,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKeyVaultExample.overrideLogicalId("example");
const azurermMachineLearningWorkspaceExample =
  new azurerm.machineLearningWorkspace.MachineLearningWorkspace(
    this,
    "example_6",
    {
      application_insights_id: azurermApplicationInsightsExample.id,
      identity: [
        {
          type: "SystemAssigned",
        },
      ],
      key_vault_id: azurermKeyVaultExample.id,
      location: azurermResourceGroupExample.location,
      name: "example-mlw",
      resource_group_name: azurermResourceGroupExample.name,
      storage_account_id: azurermStorageAccountExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMachineLearningWorkspaceExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_7", {
  address_prefixes: ["10.1.0.0/24"],
  name: "example-subnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
new azurerm.machineLearningComputeCluster.MachineLearningComputeCluster(
  this,
  "test",
  {
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    machine_learning_workspace_id: azurermMachineLearningWorkspaceExample.id,
    name: "example",
    scale_settings: [
      {
        max_node_count: 1,
        min_node_count: 0,
        scale_down_nodes_after_idle_duration: "PT30S",
      },
    ],
    subnet_resource_id: azurermSubnetExample.id,
    vm_priority: "LowPriority",
    vm_size: "Standard_DS2_v2",
  }
);

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Machine Learning Compute Cluster. Changing this forces a new Machine Learning Compute Cluster to be created.

  • machineLearningWorkspaceId - (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning Compute Cluster to be created.

  • location - (Required) The Azure Region where the Machine Learning Compute Cluster should exist. Changing this forces a new Machine Learning Compute Cluster to be created.

  • vmPriority - (Required) The priority of the VM. Changing this forces a new Machine Learning Compute Cluster to be created. Accepted values are dedicated and lowPriority.

  • vmSize - (Required) The size of the VM. Changing this forces a new Machine Learning Compute Cluster to be created.

  • scaleSettings - (Required) A scaleSettings block as defined below. Changing this forces a new Machine Learning Compute Cluster to be created.


  • ssh - (Optional) Credentials for an administrator user account that will be created on each compute node. A ssh block as defined below. Changing this forces a new Machine Learning Compute Cluster to be created.

  • description - (Optional) The description of the Machine Learning compute. Changing this forces a new Machine Learning Compute Cluster to be created.

  • identity - (Optional) An identity block as defined below. Changing this forces a new Machine Learning Compute Cluster to be created.

  • localAuthEnabled - (Optional) Whether local authentication methods is enabled. Defaults to true. Changing this forces a new Machine Learning Compute Cluster to be created.

  • sshPublicAccessEnabled - (Optional) A boolean value indicating whether enable the public SSH port. Changing this forces a new Machine Learning Compute Cluster to be created.

  • subnetResourceId - (Optional) The ID of the Subnet that the Compute Cluster should reside in. Changing this forces a new Machine Learning Compute Cluster to be created.

  • tags - (Optional) A mapping of tags which should be assigned to the Machine Learning Compute Cluster. Changing this forces a new Machine Learning Compute Cluster to be created.


An identity block supports the following:

  • type - (Required) Specifies the type of Managed Service Identity that should be configured on this Machine Learning Compute Cluster. Possible values are systemAssigned, userAssigned, systemAssigned,UserAssigned (to enable both). Changing this forces a new resource to be created.

  • identityIds - (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this Machine Learning Compute Cluster. Changing this forces a new resource to be created.

\~> NOTE: This is required when type is set to userAssigned or systemAssigned,UserAssigned.


A ssh block supports the following:

  • adminUsername - (Required) Name of the administrator user account which can be used to SSH to nodes. Changing this forces a new Machine Learning Compute Cluster to be created.

  • adminPassword - (Optional) Password of the administrator user account. Changing this forces a new Machine Learning Compute Cluster to be created.

  • keyValue - (Optional) SSH public key of the administrator user account. Changing this forces a new Machine Learning Compute Cluster to be created.

\~> NOTE: At least one of adminPassword and keyValue shoud be specified.


A scaleSettings block supports the following:

  • maxNodeCount - (Required) Maximum node count. Changing this forces a new Machine Learning Compute Cluster to be created.

  • minNodeCount - (Required) Minimal node count. Changing this forces a new Machine Learning Compute Cluster to be created.

  • scaleDownNodesAfterIdleDuration - (Required) Node Idle Time Before Scale Down: defines the time until the compute is shutdown when it has gone into Idle state. Is defined according to W3C XML schema standard for duration. Changing this forces a new Machine Learning Compute Cluster to be created.

Attributes Reference

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

  • id - The ID of the Machine Learning Compute Cluster.

  • identity - An identity block as defined below, which contains the Managed Service Identity information for this Machine Learning Compute Cluster.


A identity block exports the following:

  • principalId - The Principal ID for the Service Principal associated with the Managed Service Identity of this Machine Learning Compute Cluster.

  • tenantId - The Tenant ID for the Service Principal associated with the Managed Service Identity of this Machine Learning Compute Cluster.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Machine Learning Compute Cluster.
  • read - (Defaults to 5 minutes) Used when retrieving the Machine Learning Compute Cluster.
  • delete - (Defaults to 30 minutes) Used when deleting the Machine Learning Compute Cluster.

Import

Machine Learning Compute Clusters can be imported using the resourceId, e.g.

terraform import azurerm_machine_learning_compute_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.MachineLearningServices/workspaces/workspace1/computes/cluster1