101-machine-learning patch (#172)
* fix 101-machine-learning example * fix example
This commit is contained in:
parent
7c06cacc7e
commit
452dac32c9
@ -3,11 +3,10 @@ resource "random_string" "ci_prefix" {
|
||||
length = 8
|
||||
upper = false
|
||||
special = false
|
||||
number = false
|
||||
}
|
||||
|
||||
# Compute instance
|
||||
resource "azurerm_machine_learning_compute_instance" "compute_instance" {
|
||||
resource "azurerm_machine_learning_compute_instance" "main" {
|
||||
name = "${random_string.ci_prefix.result}instance"
|
||||
location = azurerm_resource_group.default.location
|
||||
machine_learning_workspace_id = azurerm_machine_learning_workspace.default.id
|
||||
|
@ -1,21 +1,16 @@
|
||||
terraform {
|
||||
required_version = ">=1.0"
|
||||
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = "=2.76.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
|
||||
data "azurerm_client_config" "current" {}
|
||||
|
||||
resource "azurerm_resource_group" "default" {
|
||||
name = "rg-${var.name}-${var.environment}"
|
||||
name = "${random_pet.prefix.id}-rg"
|
||||
location = var.location
|
||||
}
|
||||
|
||||
resource "random_pet" "prefix" {
|
||||
prefix = var.prefix
|
||||
length = 2
|
||||
}
|
||||
|
||||
resource "random_integer" "suffix" {
|
||||
min = 10000000
|
||||
max = 99999999
|
||||
}
|
23
quickstart/101-machine-learning/outputs.tf
Normal file
23
quickstart/101-machine-learning/outputs.tf
Normal file
@ -0,0 +1,23 @@
|
||||
output "key_vault_name" {
|
||||
value = azurerm_key_vault.default.name
|
||||
}
|
||||
|
||||
output "storage_account_name" {
|
||||
value = azurerm_storage_account.default.name
|
||||
}
|
||||
|
||||
output "container_registry_name" {
|
||||
value = azurerm_container_registry.default.name
|
||||
}
|
||||
|
||||
output "machine_learning_workspace_name" {
|
||||
value = azurerm_machine_learning_workspace.default.name
|
||||
}
|
||||
|
||||
output "machine_learning_compute_instance_name" {
|
||||
value = azurerm_machine_learning_compute_instance.main.name
|
||||
}
|
||||
|
||||
output "machine_learning_compute_cluster_name" {
|
||||
value = azurerm_machine_learning_compute_cluster.compute.name
|
||||
}
|
27
quickstart/101-machine-learning/providers.tf
Normal file
27
quickstart/101-machine-learning/providers.tf
Normal file
@ -0,0 +1,27 @@
|
||||
terraform {
|
||||
required_version = ">= 1.0"
|
||||
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = ">= 3.0, < 4.0"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = ">= 3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {
|
||||
key_vault {
|
||||
recover_soft_deleted_key_vaults = false
|
||||
purge_soft_delete_on_destroy = false
|
||||
purge_soft_deleted_keys_on_destroy = false
|
||||
}
|
||||
resource_group {
|
||||
prevent_deletion_if_contains_resources = false
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,3 @@
|
||||
variable "name" {
|
||||
type = string
|
||||
description = "Name of the deployment"
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
type = string
|
||||
description = "Name of the environment"
|
||||
@ -12,5 +7,11 @@ variable "environment" {
|
||||
variable "location" {
|
||||
type = string
|
||||
description = "Location of the resources"
|
||||
default = "East US"
|
||||
default = "eastus"
|
||||
}
|
||||
|
||||
variable "prefix" {
|
||||
type = string
|
||||
description = "Prefix of the resource name"
|
||||
default = "ml"
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
# Dependent resources for Azure Machine Learning
|
||||
resource "azurerm_application_insights" "default" {
|
||||
name = "appi-${var.name}-${var.environment}"
|
||||
name = "${random_pet.prefix.id}-appi"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
application_type = "web"
|
||||
}
|
||||
|
||||
resource "azurerm_key_vault" "default" {
|
||||
name = "kv-${var.name}-${var.environment}"
|
||||
name = "${var.prefix}${var.environment}${random_integer.suffix.result}kv"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
tenant_id = data.azurerm_client_config.current.tenant_id
|
||||
@ -16,7 +16,7 @@ resource "azurerm_key_vault" "default" {
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "default" {
|
||||
name = "st${var.name}${var.environment}"
|
||||
name = "${var.prefix}${var.environment}${random_integer.suffix.result}st"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
account_tier = "Standard"
|
||||
@ -25,7 +25,7 @@ resource "azurerm_storage_account" "default" {
|
||||
}
|
||||
|
||||
resource "azurerm_container_registry" "default" {
|
||||
name = "cr${var.name}${var.environment}"
|
||||
name = "${var.prefix}${var.environment}${random_integer.suffix.result}cr"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
sku = "Premium"
|
||||
@ -34,13 +34,14 @@ resource "azurerm_container_registry" "default" {
|
||||
|
||||
# Machine Learning workspace
|
||||
resource "azurerm_machine_learning_workspace" "default" {
|
||||
name = "mlw-${var.name}-${var.environment}"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
application_insights_id = azurerm_application_insights.default.id
|
||||
key_vault_id = azurerm_key_vault.default.id
|
||||
storage_account_id = azurerm_storage_account.default.id
|
||||
container_registry_id = azurerm_container_registry.default.id
|
||||
name = "${random_pet.prefix.id}-mlw"
|
||||
location = azurerm_resource_group.default.location
|
||||
resource_group_name = azurerm_resource_group.default.name
|
||||
application_insights_id = azurerm_application_insights.default.id
|
||||
key_vault_id = azurerm_key_vault.default.id
|
||||
storage_account_id = azurerm_storage_account.default.id
|
||||
container_registry_id = azurerm_container_registry.default.id
|
||||
public_network_access_enabled = true
|
||||
|
||||
identity {
|
||||
type = "SystemAssigned"
|
||||
|
Loading…
x
Reference in New Issue
Block a user