dependency/azapi_examples/Microsoft.MachineLearningServices_workspaces_computes@2022-05-01/main.tf (148 lines of code) (raw):

terraform { required_providers { azapi = { source = "Azure/azapi" } azurerm = { source = "hashicorp/azurerm" } } } provider "azurerm" { features { } } provider "azapi" { skip_provider_registration = false } variable "resource_name" { type = string default = "acctest0001" } variable "location" { type = string default = "westeurope" } data "azurerm_client_config" "current" { } resource "azapi_resource" "resourceGroup" { type = "Microsoft.Resources/resourceGroups@2020-06-01" name = var.resource_name location = var.location body = { tags = { stage = "test" } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_resource" "storageAccount" { type = "Microsoft.Storage/storageAccounts@2021-09-01" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location body = { kind = "StorageV2" sku = { name = "Standard_LRS" } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_resource" "component" { type = "Microsoft.Insights/components@2020-02-02" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location body = { kind = "web" properties = { Application_Type = "web" DisableIpMasking = false DisableLocalAuth = false ForceCustomerStorageForProfiler = false RetentionInDays = 90 SamplingPercentage = 100 publicNetworkAccessForIngestion = "Enabled" publicNetworkAccessForQuery = "Enabled" } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_resource" "vault" { type = "Microsoft.KeyVault/vaults@2021-10-01" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location body = { properties = { accessPolicies = [] createMode = "default" enablePurgeProtection = true enableRbacAuthorization = false enableSoftDelete = true enabledForDeployment = false enabledForDiskEncryption = false enabledForTemplateDeployment = false publicNetworkAccess = "Enabled" sku = { family = "A" name = "standard" } tenantId = data.azurerm_client_config.current.tenant_id } } schema_validation_enabled = false response_export_values = ["*"] lifecycle { ignore_changes = [body.properties.accessPolicies] } } resource "azapi_resource" "workspace" { type = "Microsoft.MachineLearningServices/workspaces@2022-05-01" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location identity { type = "SystemAssigned" identity_ids = [] } body = { properties = { applicationInsights = azapi_resource.component.id keyVault = azapi_resource.vault.id publicNetworkAccess = "Enabled" storageAccount = azapi_resource.storageAccount.id v1LegacyMode = false } sku = { name = "Basic" tier = "Basic" } } schema_validation_enabled = false ignore_casing = true response_export_values = ["*"] } resource "azapi_resource" "compute" { type = "Microsoft.MachineLearningServices/workspaces/computes@2022-05-01" parent_id = azapi_resource.workspace.id name = var.resource_name location = var.location body = { properties = { computeLocation = "westeurope" computeType = "ComputeInstance" description = "" disableLocalAuth = true properties = { vmSize = "STANDARD_D2_V2" } } } schema_validation_enabled = false response_export_values = ["*"] }