azurermMachineLearningComputeInstance
Manages a Machine Learning Compute Instance.
Example Usage
import * as cdktf from "cdktf";
/*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.*/
/*Terraform Variables are not always the best fit for getting inputs in the context of Terraform CDK.
You can read more about this at https://cdk.tf/variables*/
const sshKey = new cdktf.TerraformVariable(this, "ssh_key", {
default:
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt terraform@demo.tld",
});
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_2",
{
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_3",
{
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_5", {
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_6",
{
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_7",
{
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_8", {
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 azurermMachineLearningComputeInstanceExample =
new azurerm.machineLearningComputeInstance.MachineLearningComputeInstance(
this,
"example_9",
{
authorization_type: "personal",
description: "foo",
location: azurermResourceGroupExample.location,
machine_learning_workspace_id: azurermMachineLearningWorkspaceExample.id,
name: "example",
ssh: [
{
public_key: sshKey.value,
},
],
subnet_resource_id: azurermSubnetExample.id,
tags: {
foo: "bar",
},
virtual_machine_size: "STANDARD_DS2_V2",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMachineLearningComputeInstanceExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) The name which should be used for this Machine Learning Compute Instance. Changing this forces a new Machine Learning Compute Instance to be created. -
location
- (Required) The Azure Region where the Machine Learning Compute Instance should exist. Changing this forces a new Machine Learning Compute Instance to be created. -
machineLearningWorkspaceId
- (Required) The ID of the Machine Learning Workspace. Changing this forces a new Machine Learning Compute Instance to be created. -
virtualMachineSize
- (Required) The Virtual Machine Size. Changing this forces a new Machine Learning Compute Instance to be created.
-
authorizationType
- (Optional) The Compute Instance Authorization type. Possible values include:personal
. Changing this forces a new Machine Learning Compute Instance to be created. -
assignToUser
- (Optional) AassignToUser
block as defined below. A user explicitly assigned to a personal compute instance. Changing this forces a new Machine Learning Compute Instance to be created. -
description
- (Optional) The description of the Machine Learning Compute Instance. Changing this forces a new Machine Learning Compute Instance to be created. -
identity
- (Optional) Anidentity
block as defined below. Changing this forces a new Machine Learning Compute Instance to be created. -
localAuthEnabled
- (Optional) Whether local authentication methods is enabled. Defaults totrue
. Changing this forces a new Machine Learning Compute Instance to be created. -
ssh
- (Optional) Assh
block as defined below. Specifies policy and settings for SSH access. Changing this forces a new Machine Learning Compute Instance to be created. -
subnetResourceId
- (Optional) Virtual network subnet resource ID the compute nodes belong to. Changing this forces a new Machine Learning Compute Instance to be created. -
tags
- (Optional) A mapping of tags which should be assigned to the Machine Learning Compute Instance. Changing this forces a new Machine Learning Compute Instance 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 Instance. Possible values aresystemAssigned
,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 Instance. Changing this forces a new resource to be created.
\~> NOTE: This is required when type
is set to userAssigned
or systemAssigned,UserAssigned
.
A assignToUser
block supports the following:
-
objectId
- (Optional) User’s AAD Object Id. -
tenantId
- (Optional) User’s AAD Tenant Id.
A ssh
block supports the following:
publicKey
- (Required) Specifies the SSH rsa public key file as a string. Use "ssh-keygen -t rsa -b 2048" to generate your SSH key pairs.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
-
id
- The ID of the Machine Learning Compute Instance. -
identity
- Anidentity
block as defined below, which contains the Managed Service Identity information for this Machine Learning Compute Instance. -
ssh
- Anssh
block as defined below, which specifies policy and settings for SSH access for this Machine Learning Compute Instance.
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 Instance. -
tenantId
- The Tenant ID for the Service Principal associated with the Managed Service Identity of this Machine Learning Compute Instance.
A ssh
block exports the following:
-
username
- The admin username of this Machine Learning Compute Instance. -
port
- Describes the port for connecting through SSH.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Machine Learning Compute Instance.read
- (Defaults to 5 minutes) Used when retrieving the Machine Learning Compute Instance.delete
- (Defaults to 30 minutes) Used when deleting the Machine Learning Compute Instance.
Import
Machine Learning Compute Instances can be imported using the resourceId
, e.g.