Skip to content

Azure/terraform-azurerm-avm-res-machinelearningservices-workspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Machine Learning Workspace Module

Overview

This is an Azure Verified Module that provisions an Azure Machine Learning Workspace, which is a core resource for developing, training, and deploying machine learning models on Azure. Additionally, by setting the kind variable to Hub, this module can also provision an Azure AI Studio, which is an enhanced experience built on top of the Azure Machine Learning Workspace specifically for Generative AI use cases. Finally, if the kind variable is set to Project, this module can provision a AI Studio Project for a Hub workspace.

Functionality

  • Azure Machine Learning Workspace: The default behavior of this module is to create an Azure Machine Learning Workspace, which provides the environment and tools necessary for machine learning tasks.
  • Azure AI Studio: If the kind variable is set to Hub, the module provisions an Azure AI Studio instead, offering additional AI capabilities while still leveraging the underlying Azure Machine Learning infrastructure.

Example Usage

module "ml_workspace" {
  source  = "Azure/avm-res-machinelearningservices-workspace/azurerm"
  version = "x.x.x"

  resource_group_name = "<resource_group_name>"

  location = "<your_location>"
  kind     = "Default" # Omitting this parameter will result in the same outcome
}

This will create an Azure Machine Learning Workspace.

Requirements

The following requirements are needed by this module:

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

Description: Azure region where the resource should be deployed.

Type: string

Description: The name of the this resource.

Type: string

Description: The resource group where the resources will be deployed.

Type: string

Optional Inputs

The following input variables are optional (have default values):

Description: The AI Studio Hub ID for which to create a Project

Type: string

Default: null

Description: An object describing the AI Services resource to create or reference. This includes the following properties:

  • create_new: (Optional) A flag indicating if a new resource must be created. If set to 'false', both name and resource_group_id must be provided.
  • analysis_services_sku: (Optional) When creating a new resource, this specifies the SKU of the Azure Analysis Services server. Possible values are: D1, B1, B2, S0, S1, S2, S4, S8, S9. Availability may be impacted by region; see https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-overview#availability-by-region
  • name: (Optional) If providing an existing resource, the name of the AI Services to reference
  • resource_group_id: (Optional) If providing an existing resource, the id of the resource group where the AI Services resource resides
  • tags: (Optional) Tags for the AI Services resource.
  • create_service_connection: (Optional) Whether or not to create a service connection between the Workspace resource and AI Services resource.

Type:

object({
    create_new                = optional(bool, false)
    analysis_services_sku     = optional(string, "S0")
    name                      = optional(string, null)
    resource_group_id         = optional(string, null)
    tags                      = optional(map(string), null)
    create_service_connection = optional(bool, false)
  })

Default:

{
  "create_new": false
}

Description: An object describing the Application Insights resource to create or use for monitoring inference endpoints. This includes the following properties:

  • resource_id - (Optional) The resource ID of an existing Application Insights resource.
  • create_new - A flag indicating if a new resource must be created.
  • tags - (Optional) Tags for a new Application Insights resource.
  • log_analytics_workspace - An object describing the Log Analytics Workspace for the Application Insights resource
    • resource_id - The resource ID of an existing Log Analytics Workspace.
    • create_new - A flag indicating if a new workspace must be created.
    • tags - (Optional) Tags for the Log Analytics Workspace resource.

Type:

object({
    resource_id = optional(string, null)
    create_new  = bool
    tags        = optional(map(string), null)
    log_analytics_workspace = optional(object({
      resource_id = optional(string, null)
      create_new  = bool
      tags        = optional(map(string), null)
      }), {
      create_new = false
    })
  })

Default:

{
  "create_new": false
}

Description: An object describing the Container Registry. This includes the following properties:

  • resource_id - The resource ID of an existing Container Registry, if desired.
  • create_new - A flag indicating if a new resource must be created.
  • private_endpoints - A map of private endpoints to create on a newly created Container Registry. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
    • name - (Optional) The name of the private endpoint. One will be generated if not set.
    • subnet_resource_id - The resource ID of the subnet to deploy the private endpoint in.
    • private_dns_zone_resource_ids - (Optional) A set of resource IDs of private DNS zones to associate with the private endpoint. If not set, no zone groups will be created and the private endpoint will not be associated with any private DNS zones. DNS records must be managed external to this module.
    • private_service_connection_name - (Optional) The name of the private service connection. One will be generated if not set.
    • network_interface_name - (Optional) The name of the network interface. One will be generated if not set.
    • inherit_lock - (Optional) If set to true, the private endpoint will inherit the lock from the parent resource. Defaults to false.
  • tags - (Optional) Tags for new Container Registry resource.
  • zone_redundant - (Optional) A flag indicating whether to enable zone redundancy.

Note: This module does not support creating a container registry encrypted with customer-managed keys. Please create one beforehand and supply the resource_id.

Type:

object({
    resource_id = optional(string, null)
    create_new  = bool
    private_endpoints = optional(map(object({
      name                            = optional(string, null)
      subnet_resource_id              = optional(string, null)
      private_dns_zone_resource_ids   = optional(set(string), [])
      private_service_connection_name = optional(string, null)
      network_interface_name          = optional(string, null)
      inherit_lock                    = optional(bool, false)
    })), {})
    tags           = optional(map(string), null)
    zone_redundant = optional(bool, false)
  })

Default:

{
  "create_new": false
}

Description: Specifies whether a compute instance should be created for the workspace to provision the managed vnet. **Due to the complexity of compute instances and to prevent setting precedent that compute provisioning will be included in this module, this will be deprecated in a future release.

Type: bool

Default: false

Description: A map describing customer-managed keys to associate with the resource. This includes the following properties:

  • key_vault_resource_id - The resource ID of the Key Vault where the key is stored.
  • key_name - The name of the key.
  • key_version - (Optional) The version of the key. If not specified, the latest version is used.
  • user_assigned_identity - (Optional) An object representing a user-assigned identity with the following properties:
    • resource_id - The resource ID of the user-assigned identity.

Type:

object({
    key_vault_resource_id = string
    key_name              = string
    key_version           = optional(string, null)
    user_assigned_identity = optional(object({
      resource_id = string
    }), null)
  })

Default: null

Description: A map of diagnostic settings to create on the Azure Machine Learning Workspace. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

  • name - (Optional) The name of the diagnostic setting. One will be generated if not set, however this will not be unique if you want to create multiple diagnostic setting resources.
  • log_categories - (Optional) A set of log categories to send to the log analytics workspace. Defaults to [].
  • log_groups - (Optional) A set of log groups to send to the log analytics workspace. Defaults to ["allLogs"].
  • metric_categories - (Optional) A set of metric categories to send to the log analytics workspace. Defaults to ["AllMetrics"].
  • log_analytics_destination_type - (Optional) The destination type for the diagnostic setting. Possible values are Dedicated and AzureDiagnostics. Defaults to Dedicated.
  • workspace_resource_id - (Optional) The resource ID of the log analytics workspace to send logs and metrics to.
  • storage_account_resource_id - (Optional) The resource ID of the storage account to send logs and metrics to.
  • event_hub_authorization_rule_resource_id - (Optional) The resource ID of the event hub authorization rule to send logs and metrics to.
  • event_hub_name - (Optional) The name of the event hub. If none is specified, the default event hub will be selected.
  • marketplace_partner_resource_id - (Optional) The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic LogsLogs.

Type:

map(object({
    name                                     = optional(string, null)
    log_categories                           = optional(set(string), [])
    log_groups                               = optional(set(string), ["allLogs"])
    metric_categories                        = optional(set(string), ["AllMetrics"])
    log_analytics_destination_type           = optional(string, "Dedicated")
    workspace_resource_id                    = optional(string, null)
    storage_account_resource_id              = optional(string, null)
    event_hub_authorization_rule_resource_id = optional(string, null)
    event_hub_name                           = optional(string, null)
    marketplace_partner_resource_id          = optional(string, null)
  }))

Default: {}

Description: This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.

Type: bool

Default: true

Description: Specifies if the resource is a High Business Impact (HBI) workspace.

Type: bool

Default: false

Description: Specifies if every provisioned resource should be private and inaccessible from the Internet.

Type: bool

Default: false

Description: An object describing the Key Vault to create the private endpoint connection to. This includes the following properties:

  • resource_id - The resource ID of an existing Key Vault.
  • create_new - A flag indicating if a new resource must be created.
  • use_microsoft_managed_key_vault - A flag indicating if a microsoft managed key value should be used, no new key vault will be created (preview), flag only applicable to AI Foundry (Hub).
  • private_endpoints - A map of private endpoints to create on a newly created Key Vault. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
    • name - (Optional) The name of the private endpoint. One will be generated if not set.
    • subnet_resource_id - The resource ID of the subnet to deploy the private endpoint in.
    • private_dns_zone_resource_ids - (Optional) A set of resource IDs of private DNS zones to associate with the private endpoint. If not set, no zone groups will be created and the private endpoint will not be associated with any private DNS zones. DNS records must be managed external to this module.
    • private_service_connection_name - (Optional) The name of the private service connection. One will be generated if not set.
    • network_interface_name - (Optional) The name of the network interface. One will be generated if not set.
    • inherit_lock - (Optional) If set to true, the private endpoint will inherit the lock from the parent resource. Defaults to false.
  • tags - (Optional) Tags for the Key Vault resource.

Type:

object({
    resource_id                     = optional(string, null)
    create_new                      = optional(bool, true)
    use_microsoft_managed_key_vault = optional(bool, false)
    private_endpoints = optional(map(object({
      name                            = optional(string, null)
      subnet_resource_id              = optional(string, null)
      private_dns_zone_resource_ids   = optional(set(string), [])
      private_service_connection_name = optional(string, null)
      network_interface_name          = optional(string, null)
      inherit_lock                    = optional(bool, false)
    })), {})
    tags = optional(map(string), null)
  })

Default:

{
  "create_new": true
}

Description: The kind of the resource. This is used to determine the type of the resource. If not specified, the resource will be created as a standard resource.
Possible values are:

  • Default - The resource will be created as a standard Azure Machine Learning resource.
  • Hub - The resource will be created as an AI Hub resource.
  • Project - The resource will be created as an AI Studio Project resource.

Type: string

Default: "Default"

Description: Controls the Resource Lock configuration for this resource. The following properties can be specified:

  • kind - (Required) The type of lock. Possible values are \"CanNotDelete\" and \"ReadOnly\".
  • name - (Optional) The name of the lock. If not specified, a name will be generated based on the kind value. Changing this forces the creation of a new resource.

Type:

object({
    kind = string
    name = optional(string, null)
  })

Default: null

Description: Controls the Managed Identity configuration on this resource. The following properties can be specified:

  • system_assigned - (Optional) Specifies if the System Assigned Managed Identity should be enabled.
  • user_assigned_resource_ids - (Optional) Specifies a list of User Assigned Managed Identity resource IDs to be assigned to this resource.

Type:

object({
    system_assigned            = optional(bool, false)
    user_assigned_resource_ids = optional(set(string), [])
  })

Default: {}

Description: A map of private endpoints outbound rules for the managed network. **This will be deprecated in favor of the var.workspace_managed_network.outbound_rules in a future release. Until then, the final outbound rules of type 'PrivateEndpoint' will be a combination of this variable's value and that of workspace_managed_network.outbound_rules.private_endpoint.

  • resource_id - The resource id for the corresponding private endpoint.
  • sub_resource_target - The sub_resource_target is target for the private endpoint. e.g. account for Openai, searchService for Azure Ai Search

Type:

map(object({
    resource_id         = string
    sub_resource_target = string
  }))

Default: {}

Description: The resource id of the primary user-assigned managed identity for the workspace.

Type:

object({
    resource_id = optional(string, null)
  })

Default: {}

Description: A map of private endpoints to create on this resource. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

  • name - (Optional) The name of the private endpoint. One will be generated if not set.
  • role_assignments - (Optional) A map of role assignments to create on the private endpoint. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time. See var.role_assignments for more information.
  • lock - (Optional) The lock level to apply to the private endpoint. Default is None. Possible values are None, CanNotDelete, and ReadOnly.
  • tags - (Optional) A mapping of tags to assign to the private endpoint.
  • subnet_resource_id - The resource ID of the subnet to deploy the private endpoint in.
  • private_dns_zone_group_name - (Optional) The name of the private DNS zone group. One will be generated if not set.
  • private_dns_zone_resource_ids - (Optional) A set of resource IDs of private DNS zones to associate with the private endpoint. If not set, no zone groups will be created and the private endpoint will not be associated with any private DNS zones. DNS records must be managed external to this module.
  • application_security_group_resource_ids - (Optional) A map of resource IDs of application security groups to associate with the private endpoint. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
  • private_service_connection_name - (Optional) The name of the private service connection. One will be generated if not set.
  • network_interface_name - (Optional) The name of the network interface. One will be generated if not set.
  • location - (Optional) The Azure location where the resources will be deployed. Defaults to the location of the resource group.
  • resource_group_name - (Optional) The resource group where the resources will be deployed. Defaults to the resource group of this resource.
  • ip_configurations - (Optional) A map of IP configurations to create on the private endpoint. If not specified the platform will create one. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
    • name - The name of the IP configuration.
    • private_ip_address - The private IP address of the IP configuration.

Type:

map(object({
    name = optional(string, null)
    role_assignments = optional(map(object({
      role_definition_id_or_name             = string
      principal_id                           = string
      description                            = optional(string, null)
      skip_service_principal_aad_check       = optional(bool, false)
      condition                              = optional(string, null)
      condition_version                      = optional(string, null)
      delegated_managed_identity_resource_id = optional(string, null)
      principal_type                         = optional(string, null)
    })), {})
    lock = optional(object({
      kind = string
      name = optional(string, null)
    }), null)
    tags                                    = optional(map(string), null)
    subnet_resource_id                      = string
    private_dns_zone_group_name             = optional(string, "default")
    private_dns_zone_resource_ids           = optional(set(string), [])
    application_security_group_associations = optional(map(string), {})
    private_service_connection_name         = optional(string, null)
    network_interface_name                  = optional(string, null)
    location                                = optional(string, null)
    resource_group_name                     = optional(string, null)
    ip_configurations = optional(map(object({
      name               = string
      private_ip_address = string
    })), {})
  }))

Default: {}

Description: A map of role assignments to create on this resource. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.

  • role_definition_id_or_name - The ID or name of the role definition to assign to the principal.
  • principal_id - The ID of the principal to assign the role to.
  • description - The description of the role assignment.
  • skip_service_principal_aad_check - If set to true, skips the Azure Active Directory check for the service principal in the tenant. Defaults to false.
  • condition - The condition which will be used to scope the role assignment.
  • condition_version - The version of the condition syntax. Valid values are '2.0'.

Note: only set skip_service_principal_aad_check to true if you are assigning a role to a service principal.

Type:

map(object({
    role_definition_id_or_name             = string
    principal_id                           = string
    description                            = optional(string, null)
    skip_service_principal_aad_check       = optional(bool, false)
    condition                              = optional(string, null)
    condition_version                      = optional(string, null)
    delegated_managed_identity_resource_id = optional(string, null)
    principal_type                         = optional(string, null)
  }))

Default: {}

Description: The authentication mode used for accessing the system datastores of the workspace. Valid options include 'accessKey' and 'identity'. **This will be deprecated once the version of ARM used with the azapi provider is updated from 2024-07-01-preview as it was removed from the schema.

Type: string

Default: "identity"

Description: An object describing the Storage Account. This includes the following properties:

  • create_new - Required. If 'false', resource_id is required.
  • resource_id - The resource ID of an existing Storage Account.
  • private_endpoints - A map of private endpoints to create on a newly created Storage Account. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
    • name - (Optional) The name of the private endpoint. One will be generated if not set.
    • subnet_resource_id - The resource ID of the subnet to deploy the private endpoint in.
    • private_dns_zone_resource_ids - (Optional) A set of resource IDs of private DNS zones to associate with the private endpoint. If not set, no zone groups will be created and the private endpoint will not be associated with any private DNS zones. DNS records must be managed external to this module.
    • private_service_connection_name - (Optional) The name of the private service connection. One will be generated if not set.
    • network_interface_name - (Optional) The name of the network interface. One will be generated if not set.
    • inherit_lock - (Optional) If set to true, the private endpoint will inherit the lock from the parent resource. Defaults to false.
  • tags - (Optional) Tags for the Storage Account resource.

Note: This module does not support creating a storage account encrypted with customer-managed keys. Please create one beforehand and supply the resource_id.

Type:

object({
    resource_id = optional(string, null)
    create_new  = bool
    private_endpoints = optional(map(object({
      name                            = optional(string, null)
      subnet_resource_id              = optional(string, null)
      subresource_name                = string
      private_dns_zone_resource_ids   = optional(set(string), [])
      private_service_connection_name = optional(string, null)
      network_interface_name          = optional(string, null)
      inherit_lock                    = optional(bool, false)
    })), {})
    tags = optional(map(string), null)
  })

Default:

{
  "create_new": true
}

Description: (Optional) Tags of the resource.

Type: map(string)

Default: null

Description: The description of this workspace.

Type: string

Default: ""

Description: The friendly name for this workspace. This value in mutable.

Type: string

Default: "Workspace"

Description: Specifies properties of the workspace's managed virtual network.

  • isolation_mode: While is possible to update the workspace to enable network isolation (going from 'Disabled' to 'AllowInternetOutbound' or 'AllowOnlyApprovedOutbound'), it is not possible to disable it on a workspace with it enabled.
    • 'Disabled': Inbound and outbound traffic is unrestricted or BYO VNet to protect resources.
    • 'AllowInternetOutbound': Allow all internet outbound traffic.
    • 'AllowOnlyApprovedOutbound': Outbound traffic is allowed by specifying service tags.
  • spark_ready determines whether spark jobs will be run on the network. This value can be updated in the future.
  • outbound_rules:
    • fqdn: A map of FQDN rules. Only valid when isolation_mode is 'AllowOnlyApprovedOutbound'. **The inclusion of FQDN rules requires Azure Firewall to be deployed and used and cost will increase accordingly.
      • destination: The allowed host name. Required. Examples: '.anaconda.com' to install packages, 'pypi.org' to list dependencies, '.tensorflow.org' for use with TensorFlow examples
    • private_endpoint: A map of Private Endpoint rules.
      • resource_id: The id of the resource with the private endpoint to enable the workspace to communicate with. Required.
      • sub_resource_target: The specific target endpoint for the resource. Some Azure resources have only 1 option, while others will expose multiple. Required.
      • spark_enabled: Whether to the endpoint should be Spark-enabled. This is primarily set 'true' if, and only if, spark_ready is true.
    • service_tag: A map of Service Tag rules. Only valid when isolation_mode is 'AllowOnlyApprovedOutbound'.
      • action: The networking rule to apply. Available options are 'Allow' or 'Deny'.
      • service_tag: The target service tag.
      • address_prefixes: Optional collection of address prefixes. If provided, service_tag will be ignored.
      • protocol: The allowed protocol(s). Valid options dependent on Service Tag.
      • port_ranges: The allow port(s) / port ranges. Valid options dependent on Service Tag.

Type:

object({
    isolation_mode = string
    spark_ready    = optional(bool, true)
    outbound_rules = optional(object({
      fqdn = optional(map(object({
        destination = string
      })), {})
      private_endpoint = optional(map(object({
        resource_id         = string
        sub_resource_target = string
        spark_enabled       = optional(bool, false)
      })), {})
      service_tag = optional(map(object({
        action           = string
        service_tag      = string
        address_prefixes = optional(list(string), null)
        protocol         = string
        port_ranges      = string
      })), {})
    }), {})
  })

Default:

{
  "isolation_mode": "Disabled",
  "spark_ready": true
}

Outputs

The following outputs are exported:

Description: The AI Services resource, if created.

Description: The service connection between the AIServices and the workspace, if created.

Description: The application insights resource, if created.

Description: The container registry resource, if created.

Description: The key vault resource, if created.

Description: A map of the private endpoints created.

Description: The machine learning workspace.

Description: The ID of the machine learning workspace.

Description: The storage account resource, if created.

Description: The machine learning workspace created.

Description: The identity for the created workspace.

Modules

The following Modules are called:

Source: Azure/avm-res-containerregistry-registry/azurerm

Version: ~> 0.4

Source: Azure/avm-res-insights-component/azurerm

Version: ~> 0.1

Source: Azure/avm-res-keyvault-vault/azurerm

Version: ~> 0.9

Source: Azure/avm-res-operationalinsights-workspace/azurerm

Version: ~> 0.4

Source: Azure/avm-res-storage-storageaccount/azurerm

Version: ~> 0.4

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.