Compare commits
19 Commits
301-hub-sp
...
301-machin
Author | SHA1 | Date | |
---|---|---|---|
5e5d975f67 | |||
30e5ac224b | |||
73c1ca51f1 | |||
0a6ee4d6d3 | |||
ee8733602b | |||
3e8e2078ab | |||
a43c127c8e | |||
4bb8b212ac | |||
64e270d463 | |||
fd903819cd | |||
91b73244e5 | |||
77dcd8d154 | |||
c3ecd139eb | |||
7c6d6f9438 | |||
181b34291c | |||
1b713632d1 | |||
96cd33dea4 | |||
376f0a3732 | |||
e07726ef45 |
@ -4,7 +4,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
source = "hashicorp/azurerm"
|
source = "hashicorp/azurerm"
|
||||||
version = "~>2.0"
|
version = "~>3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,6 +17,15 @@ provider "azurerm" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "random_password" "password" {
|
||||||
|
count = var.admin_password == null ? 1 : 0
|
||||||
|
length = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
admin_password = try(random_password.password[0].result, var.admin_password)
|
||||||
|
}
|
||||||
|
|
||||||
resource "azurerm_resource_group" "vmss" {
|
resource "azurerm_resource_group" "vmss" {
|
||||||
name = var.resource_group_name
|
name = var.resource_group_name
|
||||||
location = var.location
|
location = var.location
|
||||||
@ -27,7 +36,7 @@ resource "random_string" "fqdn" {
|
|||||||
length = 6
|
length = 6
|
||||||
special = false
|
special = false
|
||||||
upper = false
|
upper = false
|
||||||
number = false
|
numeric = false
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_virtual_network" "vmss" {
|
resource "azurerm_virtual_network" "vmss" {
|
||||||
@ -73,14 +82,12 @@ resource "azurerm_lb_backend_address_pool" "bpepool" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_probe" "vmss" {
|
resource "azurerm_lb_probe" "vmss" {
|
||||||
resource_group_name = azurerm_resource_group.vmss.name
|
|
||||||
loadbalancer_id = azurerm_lb.vmss.id
|
loadbalancer_id = azurerm_lb.vmss.id
|
||||||
name = "ssh-running-probe"
|
name = "ssh-running-probe"
|
||||||
port = var.application_port
|
port = var.application_port
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "lbnatrule" {
|
resource "azurerm_lb_rule" "lbnatrule" {
|
||||||
resource_group_name = azurerm_resource_group.vmss.name
|
|
||||||
loadbalancer_id = azurerm_lb.vmss.id
|
loadbalancer_id = azurerm_lb.vmss.id
|
||||||
name = "http"
|
name = "http"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
@ -127,7 +134,7 @@ resource "azurerm_virtual_machine_scale_set" "vmss" {
|
|||||||
os_profile {
|
os_profile {
|
||||||
computer_name_prefix = "vmlab"
|
computer_name_prefix = "vmlab"
|
||||||
admin_username = var.admin_user
|
admin_username = var.admin_user
|
||||||
admin_password = var.admin_password
|
admin_password = local.admin_password
|
||||||
custom_data = file("web.conf")
|
custom_data = file("web.conf")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +205,7 @@ resource "azurerm_virtual_machine" "jumpbox" {
|
|||||||
os_profile {
|
os_profile {
|
||||||
computer_name = "jumpbox"
|
computer_name = "jumpbox"
|
||||||
admin_username = var.admin_user
|
admin_username = var.admin_user
|
||||||
admin_password = var.admin_password
|
admin_password = local.admin_password
|
||||||
}
|
}
|
||||||
|
|
||||||
os_profile_linux_config {
|
os_profile_linux_config {
|
||||||
|
@ -28,6 +28,6 @@ variable "admin_user" {
|
|||||||
|
|
||||||
variable "admin_password" {
|
variable "admin_password" {
|
||||||
description = "Default password for admin account"
|
description = "Default password for admin account"
|
||||||
default = "ChangeMe123!"
|
default = null
|
||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ resource "random_string" "fw_diag_prefix" {
|
|||||||
length = 8
|
length = 8
|
||||||
upper = false
|
upper = false
|
||||||
special = false
|
special = false
|
||||||
number = false
|
numeric = false
|
||||||
}
|
}
|
||||||
resource "azurerm_ip_group" "ip_group_hub" {
|
resource "azurerm_ip_group" "ip_group_hub" {
|
||||||
name = "hub-ipgroup"
|
name = "hub-ipgroup"
|
||||||
@ -47,6 +47,8 @@ resource "azurerm_firewall" "azure_firewall_instance" {
|
|||||||
name = "afw-${var.name}-${var.environment}"
|
name = "afw-${var.name}-${var.environment}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.hub_rg.name
|
resource_group_name = azurerm_resource_group.hub_rg.name
|
||||||
|
sku_name = "AZFW_VNet"
|
||||||
|
sku_tier = "Standard"
|
||||||
firewall_policy_id = azurerm_firewall_policy.base_policy.id
|
firewall_policy_id = azurerm_firewall_policy.base_policy.id
|
||||||
|
|
||||||
ip_configuration {
|
ip_configuration {
|
||||||
@ -105,6 +107,11 @@ resource "azurerm_monitor_diagnostic_setting" "azure_firewall_instance" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [
|
||||||
|
log
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_firewall_policy_rule_collection_group" "azure_firewall_rules_collection" {
|
resource "azurerm_firewall_policy_rule_collection_group" "azure_firewall_rules_collection" {
|
||||||
|
@ -3,7 +3,7 @@ resource "random_string" "ci_prefix" {
|
|||||||
length = 8
|
length = 8
|
||||||
upper = false
|
upper = false
|
||||||
special = false
|
special = false
|
||||||
number = false
|
numeric = false
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compute instance
|
# Compute instance
|
||||||
|
@ -10,6 +10,15 @@ resource "azurerm_network_interface" "dsvm" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "random_password" "dsvm_host_password" {
|
||||||
|
count = var.dsvm_host_password == null ? 1 : 0
|
||||||
|
length = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
dsvm_host_password = try(random_password.dsvm_host_password[0].result, var.dsvm_host_password)
|
||||||
|
}
|
||||||
|
|
||||||
resource "azurerm_windows_virtual_machine" "dsvm" {
|
resource "azurerm_windows_virtual_machine" "dsvm" {
|
||||||
name = var.dsvm_name
|
name = var.dsvm_name
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
@ -37,12 +46,18 @@ resource "azurerm_windows_virtual_machine" "dsvm" {
|
|||||||
}
|
}
|
||||||
computer_name = var.dsvm_name
|
computer_name = var.dsvm_name
|
||||||
admin_username = var.dsvm_admin_username
|
admin_username = var.dsvm_admin_username
|
||||||
admin_password = var.dsvm_host_password
|
admin_password = local.dsvm_host_password
|
||||||
|
|
||||||
provision_vm_agent = true
|
provision_vm_agent = true
|
||||||
|
vm_agent_platform_updates_enabled = false
|
||||||
|
|
||||||
timeouts {
|
timeouts {
|
||||||
create = "60m"
|
create = "60m"
|
||||||
delete = "2h"
|
delete = "2h"
|
||||||
}
|
}
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [
|
||||||
|
vm_agent_platform_updates_enabled,
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,29 +4,43 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
azurerm = {
|
azurerm = {
|
||||||
source = "hashicorp/azurerm"
|
source = "hashicorp/azurerm"
|
||||||
version = "=2.78.0"
|
version = "~> 3.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
azureml = {
|
azureml = {
|
||||||
source = "registry.terraform.io/Telemaco019/azureml"
|
source = "registry.terraform.io/orobix/azureml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "azurerm" {
|
provider "azurerm" {
|
||||||
features {}
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data "azurerm_client_config" "current" {}
|
data "azurerm_client_config" "current" {}
|
||||||
|
|
||||||
|
resource "random_string" "suffix" {
|
||||||
|
length = 4
|
||||||
|
upper = false
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
resource "azurerm_resource_group" "default" {
|
resource "azurerm_resource_group" "default" {
|
||||||
name = "rg-${var.name}-${var.environment}"
|
name = "rg-${var.name}-${var.environment}-${random_string.suffix.result}"
|
||||||
location = var.location
|
location = var.location
|
||||||
}
|
}
|
||||||
|
|
||||||
#Hub Resource Group
|
#Hub Resource Group
|
||||||
resource "azurerm_resource_group" "hub_rg" {
|
resource "azurerm_resource_group" "hub_rg" {
|
||||||
name = "rg-hub-${var.name}-${var.environment}"
|
name = "rg-hub-${var.name}-${var.environment}-${random_string.suffix.result}"
|
||||||
location = var.location
|
location = var.location
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
variable "name" {
|
variable "name" {
|
||||||
type = string
|
type = string
|
||||||
description = "Name of the deployment"
|
description = "Name of the deployment"
|
||||||
|
default = "301mlhss"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment" {
|
variable "environment" {
|
||||||
@ -90,4 +91,5 @@ variable "dsvm_host_password" {
|
|||||||
type = string
|
type = string
|
||||||
description = "Password for the admin username of the Data Science VM"
|
description = "Password for the admin username of the Data Science VM"
|
||||||
sensitive = true
|
sensitive = true
|
||||||
|
default = null
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
# Dependent resources for Azure Machine Learning
|
# Dependent resources for Azure Machine Learning
|
||||||
resource "azurerm_application_insights" "default" {
|
resource "azurerm_application_insights" "default" {
|
||||||
name = "appi-${var.name}-${var.environment}"
|
name = "appi-${var.name}-${var.environment}-${random_string.suffix.result}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.default.name
|
resource_group_name = azurerm_resource_group.default.name
|
||||||
workspace_id = azurerm_log_analytics_workspace.default.id
|
workspace_id = azurerm_log_analytics_workspace.default.id
|
||||||
@ -8,7 +8,7 @@ resource "azurerm_application_insights" "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_key_vault" "default" {
|
resource "azurerm_key_vault" "default" {
|
||||||
name = "kv-${var.name}-${var.environment}"
|
name = "kv-${var.name}-${var.environment}-${random_string.suffix.result}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.default.name
|
resource_group_name = azurerm_resource_group.default.name
|
||||||
tenant_id = data.azurerm_client_config.current.tenant_id
|
tenant_id = data.azurerm_client_config.current.tenant_id
|
||||||
@ -22,7 +22,7 @@ resource "azurerm_key_vault" "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_storage_account" "default" {
|
resource "azurerm_storage_account" "default" {
|
||||||
name = "st${var.name}${var.environment}"
|
name = "st${var.name}${var.environment}${random_string.suffix.result}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.default.name
|
resource_group_name = azurerm_resource_group.default.name
|
||||||
account_tier = "Standard"
|
account_tier = "Standard"
|
||||||
@ -36,7 +36,7 @@ resource "azurerm_storage_account" "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_container_registry" "default" {
|
resource "azurerm_container_registry" "default" {
|
||||||
name = "cr${var.name}${var.environment}"
|
name = "cr${var.name}${var.environment}${random_string.suffix.result}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.default.name
|
resource_group_name = azurerm_resource_group.default.name
|
||||||
sku = "Premium"
|
sku = "Premium"
|
||||||
@ -50,7 +50,7 @@ resource "azurerm_container_registry" "default" {
|
|||||||
|
|
||||||
# Machine Learning workspace
|
# Machine Learning workspace
|
||||||
resource "azurerm_machine_learning_workspace" "default" {
|
resource "azurerm_machine_learning_workspace" "default" {
|
||||||
name = "mlw-${var.name}-${var.environment}"
|
name = "mlw-${var.name}-${var.environment}-${random_string.suffix.result}"
|
||||||
location = azurerm_resource_group.default.location
|
location = azurerm_resource_group.default.location
|
||||||
resource_group_name = azurerm_resource_group.default.name
|
resource_group_name = azurerm_resource_group.default.name
|
||||||
application_insights_id = azurerm_application_insights.default.id
|
application_insights_id = azurerm_application_insights.default.id
|
||||||
@ -76,6 +76,13 @@ resource "azurerm_machine_learning_workspace" "default" {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "time_sleep" "one_min" {
|
||||||
|
create_duration = "1m"
|
||||||
|
depends_on = [
|
||||||
|
azurerm_windows_virtual_machine.dsvm
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
# Private endpoints
|
# Private endpoints
|
||||||
resource "azurerm_private_endpoint" "kv_ple" {
|
resource "azurerm_private_endpoint" "kv_ple" {
|
||||||
name = "ple-${var.name}-${var.environment}-kv"
|
name = "ple-${var.name}-${var.environment}-kv"
|
||||||
@ -94,6 +101,9 @@ resource "azurerm_private_endpoint" "kv_ple" {
|
|||||||
subresource_names = ["vault"]
|
subresource_names = ["vault"]
|
||||||
is_manual_connection = false
|
is_manual_connection = false
|
||||||
}
|
}
|
||||||
|
depends_on = [
|
||||||
|
time_sleep.one_min
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_private_endpoint" "st_ple_blob" {
|
resource "azurerm_private_endpoint" "st_ple_blob" {
|
||||||
@ -113,6 +123,9 @@ resource "azurerm_private_endpoint" "st_ple_blob" {
|
|||||||
subresource_names = ["blob"]
|
subresource_names = ["blob"]
|
||||||
is_manual_connection = false
|
is_manual_connection = false
|
||||||
}
|
}
|
||||||
|
depends_on = [
|
||||||
|
time_sleep.one_min
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_private_endpoint" "storage_ple_file" {
|
resource "azurerm_private_endpoint" "storage_ple_file" {
|
||||||
@ -132,6 +145,9 @@ resource "azurerm_private_endpoint" "storage_ple_file" {
|
|||||||
subresource_names = ["file"]
|
subresource_names = ["file"]
|
||||||
is_manual_connection = false
|
is_manual_connection = false
|
||||||
}
|
}
|
||||||
|
depends_on = [
|
||||||
|
time_sleep.one_min
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_private_endpoint" "cr_ple" {
|
resource "azurerm_private_endpoint" "cr_ple" {
|
||||||
@ -151,6 +167,9 @@ resource "azurerm_private_endpoint" "cr_ple" {
|
|||||||
subresource_names = ["registry"]
|
subresource_names = ["registry"]
|
||||||
is_manual_connection = false
|
is_manual_connection = false
|
||||||
}
|
}
|
||||||
|
depends_on = [
|
||||||
|
time_sleep.one_min
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_private_endpoint" "mlw_ple" {
|
resource "azurerm_private_endpoint" "mlw_ple" {
|
||||||
@ -170,6 +189,9 @@ resource "azurerm_private_endpoint" "mlw_ple" {
|
|||||||
subresource_names = ["amlworkspace"]
|
subresource_names = ["amlworkspace"]
|
||||||
is_manual_connection = false
|
is_manual_connection = false
|
||||||
}
|
}
|
||||||
|
depends_on = [
|
||||||
|
time_sleep.one_min
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compute cluster for image building required since the workspace is behind a vnet.
|
# Compute cluster for image building required since the workspace is behind a vnet.
|
||||||
|
Reference in New Issue
Block a user