Skip to content

azurermMachineLearningInferenceCluster

Manages a Machine Learning Inference Cluster.

\~> NOTE: The Machine Learning Inference Cluster resource is used to attach an existing AKS cluster to the Machine Learning Workspace, it doesn't create the AKS cluster itself. Therefore it can only be created and deleted, not updated. Any change to the configuration will recreate the resource.

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");
const azurermKubernetesClusterExample =
  new azurerm.kubernetesCluster.KubernetesCluster(this, "example_8", {
    default_node_pool: [
      {
        name: "default",
        node_count: 3,
        vm_size: "Standard_D3_v2",
        vnet_subnet_id: azurermSubnetExample.id,
      },
    ],
    dns_prefix_private_cluster: "prefix",
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example-aks",
    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.*/
azurermKubernetesClusterExample.overrideLogicalId("example");
const azurermMachineLearningInferenceClusterExample =
  new azurerm.machineLearningInferenceCluster.MachineLearningInferenceCluster(
    this,
    "example_9",
    {
      cluster_purpose: "FastProd",
      description: "This is an example cluster used with Terraform",
      kubernetes_cluster_id: azurermKubernetesClusterExample.id,
      location: azurermResourceGroupExample.location,
      machine_learning_workspace_id: azurermMachineLearningWorkspaceExample.id,
      name: "example",
      tags: {
        stage: "example",
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMachineLearningInferenceClusterExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

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

  • kubernetesClusterId - (Required) The ID of the Kubernetes Cluster. Changing this forces a new Machine Learning Inference Cluster to be created.

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

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


  • clusterPurpose - (Optional) The purpose of the Inference Cluster. Options are devTest, denseProd and fastProd. If used for Development or Testing, use devTest here. Default purpose is fastProd, which is recommended for production workloads. Changing this forces a new Machine Learning Inference Cluster to be created.

\~> NOTE: When creating or attaching a cluster, if the cluster will be used for production (clusterPurpose = "fastProd"), then it must contain at least 12 virtual CPUs. The number of virtual CPUs can be calculated by multiplying the number of nodes in the cluster by the number of cores provided by the VM size selected. For example, if you use a VM size of "Standard_D3_v2", which has 4 virtual cores, then you should select 3 or greater as the number of nodes.

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

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

  • ssl - (Optional) A ssl block as defined below. Changing this forces a new Machine Learning Inference Cluster to be created.

  • tags - (Optional) A mapping of tags which should be assigned to the Machine Learning Inference Cluster. Changing this forces a new Machine Learning Inference 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 Inference 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 Inference Cluster. Changing this forces a new resource to be created.

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


A ssl block supports the following:

  • cert - (Optional) The certificate for the SSL configuration.Conflicts with ssl0LeafDomainLabel,ssl0OverwriteExistingDomain. Changing this forces a new Machine Learning Inference Cluster to be created. Defaults to "".

  • cname - (Optional) The cname of the SSL configuration.Conflicts with ssl0LeafDomainLabel,ssl0OverwriteExistingDomain. Changing this forces a new Machine Learning Inference Cluster to be created. Defaults to "".

  • key - (Optional) The key content for the SSL configuration.Conflicts with ssl0LeafDomainLabel,ssl0OverwriteExistingDomain. Changing this forces a new Machine Learning Inference Cluster to be created. Defaults to "".

  • leafDomainLabel - (Optional) The leaf domain label for the SSL configuration. Conflicts with ssl0Cert,ssl0Key,ssl0Cname. Changing this forces a new Machine Learning Inference Cluster to be created. Defaults to "".

  • overwriteExistingDomain - (Optional) Whether or not to overwrite existing leaf domain. Conflicts with ssl0Cert,ssl0Key,ssl0Cname Changing this forces a new Machine Learning Inference Cluster to be created. Defaults to "".

Attributes Reference

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

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

  • identity - An identity block as defined below, which contains the Managed Service Identity information for this Machine Learning Inference 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 Inference Cluster.

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

Timeouts

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

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

Import

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

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