Skip to content

Commit 991c394

Browse files
committed
edits
1 parent 51f1fd1 commit 991c394

File tree

1 file changed

+43
-38
lines changed

1 file changed

+43
-38
lines changed
Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
---
2-
title: Manage workspaces by using Terraform
2+
title: Create workspaces by using Terraform
33
titleSuffix: Azure Machine Learning
4-
description: Learn how to create and manage Azure Machine Learning workspaces by using Terraform.
4+
description: Learn how to create Azure Machine Learning workspaces with public or private connectivity by using Terraform.
55
services: machine-learning
66
ms.service: machine-learning
77
ms.subservice: enterprise-readiness
88
ms.custom: devx-track-terraform
99
ms.author: deeikele
1010
author: denniseik
1111
ms.reviewer: larryfr
12-
ms.date: 06/14/2024
12+
ms.date: 06/17/2024
1313
ms.topic: how-to
1414
ms.tool: terraform
1515
---
1616

1717
# Manage Azure Machine Learning workspaces by using Terraform
1818

19-
In this article, you learn how to create and manage an Azure Machine Learning workspace using Terraform configuration files. [Terraform](/azure/developer/terraform/) template-based configuration files enable you to define, create, and configure Azure resources in a repeatable and predictable manner. Terraform tracks resource state and can clean up and destroy resources.
19+
In this article, you learn how to create an Azure Machine Learning workspace by using Terraform configuration files. [Terraform](/azure/developer/terraform/) template-based configuration files enable you to define, create, and configure Azure resources in a repeatable and predictable manner. Terraform tracks resource state and can clean up and destroy resources.
2020

21-
A Terraform configuration is a document that defines the resources needed for a deployment. The configuration can also specify deployment variables you can use to provide input values when you use the configuration.
21+
A Terraform configuration file is a document that defines the resources needed for a deployment. The Terraform configuration can also specify deployment variables to use to provide input values when you apply the configuration.
2222

2323
## Prerequisites
2424

2525
- An Azure subscription with a free or paid version of Azure Machine Learning. If you don't have an Azure subscription, [create a free account before you begin](https://azure.microsoft.com/free/).
26-
- [Azure CLI](/cli/azure/install-azure-cli) installed.
27-
- Terraform configured according to the instructions in this article and in [Configure Terraform in Azure Cloud Shell with Bash](/azure/developer/terraform/get-started-cloud-shell).
26+
- Terraform installed and configured according to the instructions in [Quickstart: Install and configure Terraform](/azure/developer/terraform/quickstart-configure).
27+
<!--- [Azure CLI](/cli/azure/install-azure-cli) installed.-->
2828

2929
## Limitations
3030

@@ -34,30 +34,22 @@ A Terraform configuration is a document that defines the resources needed for a
3434

3535
[!INCLUDE [application-insight](includes/machine-learning-application-insight.md)]
3636

37-
## Declare the Azure provider
37+
## Create the workspace
3838

39-
Create the Terraform configuration file that declares the Azure provider:
39+
First, declare the Azure provider in a file named *main.tf* that has the following code.
4040

41-
1. In a Bash shell, create a new file named *main.tf*.
41+
:::code language="terraform" source="~/terraform/quickstart/101-machine-learning/main.tf":::
4242

43-
```bash
44-
code main.tf
45-
```
43+
### Configure the workspace
4644

47-
1. Paste the following code into the editor:
45+
To create an Azure Machine Learning workspace, use one of the following Terraform configurations. An Azure Machine Learning workspace requires various other services as dependencies. The template specifies these [associated resources](./concept-workspace.md#associated-resources). Depending on your needs, you can choose to use a template that creates resources with either public or private network connectivity.
4846

49-
:::code language="terraform" source="~/terraform/quickstart/101-machine-learning/main.tf":::
50-
51-
1. Save the file by pressing Ctrl+S and exit the editor by pressing Ctrl+Q.
52-
53-
## Deploy a workspace
54-
55-
Use one of the following Terraform configurations to create an Azure Machine Learning workspace. An Azure Machine Learning workspace requires various other services as dependencies. The template also specifies these [dependent associated resources](./concept-workspace.md#associated-resources). Depending on your needs, you can choose to use a template that creates resources with either public or private network connectivity.
47+
> [!NOTE]
48+
> Some resources in Azure require globally unique names. Before deploying your resources, make sure to set `name` variables to unique values.
5649
5750
# [Public network](#tab/publicworkspace)
5851

59-
The following configuration crates a workspace with public network connectivity.
60-
<!-- Some resources in Azure require globally unique names. Before deploying your resources using the following templates, set the `name` variable to a value that is unique.-->
52+
The following configuration creates a workspace with public network connectivity.
6153

6254
Define the following variables in a file called *variables.tf*.
6355

@@ -69,10 +61,9 @@ Define the following workspace configuration in a file called *workspace.tf*:
6961

7062
# [Private network](#tab/privateworkspace)
7163

72-
The following configuration creates a workspace in an isolated network environment by using Azure Private Link endpoints. The template includes [private DNS zones](../dns/private-dns-privatednszone.md) to resolve domain names within the virtual network.
73-
<!-- Some resources in Azure require globally unique names. Before deploying your resources using the following templates, set the `resourceprefix` variable to a value that is unique.-->
64+
The following configuration creates a workspace in an isolated network environment by using Azure Private Link endpoints. The template includes [private Domain Name System (DNS) zones](../dns/private-dns-privatednszone.md) to resolve domain names within the virtual network.
7465

75-
If you use private link endpoints for both Azure Container Registry and Azure Machine Learning, you can't use Container Registry tasks for building [environment](/python/api/azure-ai-ml/azure.ai.ml.entities.environment) images. Instead you can build images by using an Azure Machine Learning compute cluster.
66+
If you use private link endpoints for both Azure Container Registry and Azure Machine Learning, you can't use Container Registry tasks for building [environment](/python/api/azure-ai-ml/azure.ai.ml.entities.environment) images. Instead you must build images by using an Azure Machine Learning compute cluster.
7667

7768
To configure the cluster name to use, set the [image_build_compute_name](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/machine_learning_workspace) argument. You can also [allow public access](./how-to-configure-private-link.md?tabs=python#enable-public-access) to a workspace that has a private link endpoint by using the [public_network_access_enabled](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/machine_learning_workspace) argument.
7869

@@ -87,7 +78,7 @@ Define the following workspace configuration in a file called *workspace.tf*:
8778
Define the following network configuration in a file called *network.tf*:
8879

8980
```terraform
90-
# Virtual Network
81+
# Virtual network
9182
resource "azurerm_virtual_network" "default" {
9283
name = "vnet-${var.name}-${var.environment}"
9384
address_space = var.vnet_address_space
@@ -118,30 +109,44 @@ resource "azurerm_subnet" "snet-workspace" {
118109
address_prefixes = var.ml_subnet_address_space
119110
enforce_private_link_endpoint_network_policies = true
120111
}
121-
122-
# ...
123-
# For a full reference, see: https://github.com/Azure/terraform/blob/master/quickstart/201-machine-learning-moderately-secure/network.tf
124112
```
125113

126-
To learn more about the options to connect to your private link endpoint workspace, see [Securely connect to your workspace](./how-to-secure-workspace-vnet.md#securely-connect-to-your-workspace).
114+
- For a full reference, see [201: Machine learning workspace, compute, and a set of network components for network isolation](https://github.com/Azure/terraform/blob/master/quickstart/201-machine-learning-moderately-secure/network.tf).
115+
- To learn more about how to connect to your private link endpoint workspace, see [Securely connect to your workspace](./how-to-secure-workspace-vnet.md#securely-connect-to-your-workspace).
127116

128117
---
129118

119+
## Create and apply the plan
120+
121+
To create the workspace, run the following code:
122+
123+
```terraform
124+
terraform init
125+
126+
terraform plan \
127+
-var name=<deployment-name> \
128+
-var environment=<environment-name> \
129+
# -var <any of the variables set in variables.tf> \
130+
-out demo.tfplan
131+
132+
terraform apply "demo.tfplan"
133+
```
134+
130135
## Troubleshoot resource provider errors
131136

132137
[!INCLUDE [machine-learning-resource-provider](includes/machine-learning-resource-provider.md)]
133138

134139
## Related resources
135140

136141
- To learn more about Terraform support on Azure, see [Terraform on Azure documentation](/azure/developer/terraform/).
137-
- For details on the Terraform Azure provider and Machine Learning module, see [Terraform Registry Azure Resource Manager Provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/machine_learning_workspace).
138-
- To find quickstart template examples for Terraform, see [Azure Terraform QuickStart Templates](https://github.com/Azure/terraform/tree/master/quickstart).
142+
- For details on the Terraform Azure provider and Machine Learning module, see [Terraform Registry Azure Resource Manager provider](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/machine_learning_workspace).
143+
- To find quickstart template examples for Terraform, see the following [Azure Terraform quickstart templates](https://github.com/Azure/terraform/tree/master/quickstart).
139144

140-
- [101: Machine learning workspace and compute](https://github.com/Azure/terraform/tree/master/quickstart/101-machine-learning) the minimal set of resources needed to get started with Azure Machine Learning.
141-
- [201: Machine learning workspace, compute, and a set of network components for network isolation](https://github.com/Azure/terraform/tree/master/quickstart/201-machine-learning-moderately-secure) all resources that are needed to create a production-pilot environment for use with HBI data.
142-
- [202: Similar to 201, but with the option to bring existing network components.](https://github.com/Azure/terraform/tree/master/quickstart/202-machine-learning-moderately-secure-existing-VNet).
143-
- [301: Machine Learning workspace (Secure Hub and Spoke with Firewall)](https://github.com/azure/terraform/tree/master/quickstart/301-machine-learning-hub-spoke-secure).
145+
- [101: Machine learning workspace and compute](https://github.com/Azure/terraform/tree/master/quickstart/101-machine-learning) provides the minimal set of resources needed to get started with Azure Machine Learning.
146+
- [201: Machine learning workspace, compute, and a set of network components for network isolation](https://github.com/Azure/terraform/tree/master/quickstart/201-machine-learning-moderately-secure) provides all resources needed to create a production-pilot environment for use with high business impact (HBI) data.
147+
- [202: Similar to 201, but with the option to bring existing network components](https://github.com/Azure/terraform/tree/master/quickstart/202-machine-learning-moderately-secure-existing-VNet).
148+
- [301: Machine Learning workspace (secure hub and spoke with firewall)](https://github.com/azure/terraform/tree/master/quickstart/301-machine-learning-hub-spoke-secure).
144149

145150
- To learn more about network configuration options, see [Secure Azure Machine Learning workspace resources using virtual networks](./how-to-network-security-overview.md).
146151
- For alternative Azure Resource Manager template-based deployments, see [Deploy resources with Resource Manager templates and Resource Manager REST API](/azure/azure-resource-manager/templates/deploy-rest).
147-
- For information on how to keep your Azure Machine Learning up to date with the latest security updates, see [Vulnerability management](concept-vulnerability-management.md).
152+
- For information on how to keep your Azure Machine Learning workspace up to date with the latest security updates, see [Vulnerability management](concept-vulnerability-management.md).

0 commit comments

Comments
 (0)