dependency/azapi_examples/Microsoft.Monitor_accounts_privateEndpointConnections@2023-04-03/main.tf (99 lines of code) (raw):

terraform { required_providers { azapi = { source = "Azure/azapi" } } } provider "azapi" { skip_provider_registration = false } variable "resource_name" { type = string default = "acctest0001" } variable "location" { type = string default = "eastus" } resource "azapi_resource" "resourceGroup" { type = "Microsoft.Resources/resourceGroups@2020-06-01" name = var.resource_name location = var.location } resource "azapi_resource" "account" { type = "Microsoft.Monitor/accounts@2023-04-03" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location body = { properties = { publicNetworkAccess = "Disabled" } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_resource" "grafana" { type = "Microsoft.Dashboard/grafana@2023-09-01" parent_id = azapi_resource.resourceGroup.id name = var.resource_name location = var.location body = { identity = { type = "None" userAssignedIdentities = null }, properties = { apiKey = "Disabled" autoGeneratedDomainNameLabelScope = "TenantReuse" deterministicOutboundIP = "Disabled" publicNetworkAccess = "Disabled" zoneRedundancy = "Disabled" grafanaIntegrations = { azureMonitorWorkspaceIntegrations = [ { azureMonitorWorkspaceResourceId = azapi_resource.account.id } ] } } sku = { name = "Standard" } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_resource" "managedPrivateEndpoint" { type = "Microsoft.Dashboard/grafana/managedPrivateEndpoints@2023-09-01" parent_id = azapi_resource.grafana.id name = var.resource_name location = var.location body = { properties = { groupIds = [ "prometheusMetrics" ] privateLinkResourceId = azapi_resource.account.id privateLinkResourceRegion = var.location } } schema_validation_enabled = false response_export_values = ["*"] } resource "azapi_update_resource" "grafana_managed_private_endpoint_connection_approval" { type = "Microsoft.Monitor/accounts/privateEndpointConnections@2023-04-03" name = azapi_resource.account.output.properties.privateEndpointConnections[0].name parent_id = azapi_resource.account.id body = { properties = { privateLinkServiceConnectionState = { actionsRequired = "None" description = "Approved via Terraform" status = "Approved" } } } depends_on = [azapi_resource.managedPrivateEndpoint] }