dependency/azapi_examples/Microsoft.MachineLearningServices_workspaces@2022-05-01/main.tf (170 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"
properties = {
accessTier = "Hot"
allowBlobPublicAccess = true
allowCrossTenantReplication = true
allowSharedKeyAccess = true
defaultToOAuthAuthentication = false
encryption = {
keySource = "Microsoft.Storage"
services = {
queue = {
keyType = "Service"
}
table = {
keyType = "Service"
}
}
}
isHnsEnabled = false
isNfsV3Enabled = false
isSftpEnabled = false
minimumTlsVersion = "TLS1_2"
networkAcls = {
defaultAction = "Allow"
}
publicNetworkAccess = "Enabled"
supportsHttpsTrafficOnly = true
}
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 = [
{
objectId = "45a2d1ea-488a-44b0-bb2e-3cd8e485ebef"
permissions = {
certificates = [
"all",
]
keys = [
"all",
]
secrets = [
"all",
]
storage = []
}
tenantId = data.azurerm_client_config.current.tenant_id
}
]
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 = ["*"]
}
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 = "Disabled"
storageAccount = azapi_resource.storageAccount.id
v1LegacyMode = false
}
sku = {
name = "Basic"
tier = "Basic"
}
}
ignore_casing = true
schema_validation_enabled = false
response_export_values = ["*"]
}