Skip to content

Commit

Permalink
Remove jsonencode for azapi resources
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinbuss committed Jul 12, 2024
1 parent 350010a commit 6f01c8a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "azapi_resource" "ai_studio_hub_connections" {
name = each.key
parent_id = azapi_resource.ai_studio_hub.id

body = jsonencode({
body = {
properties = {
authType = each.value.auth_type
category = each.value.category
Expand All @@ -15,8 +15,7 @@ resource "azapi_resource" "ai_studio_hub_connections" {
target = each.value.target
metadata = each.value.metadata
}

})
}

response_export_values = []
schema_validation_enabled = false # Can be reverted once this is closed: https://github.com/Azure/terraform-provider-azapi/issues/524
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "azapi_resource" "ai_studio_hub" {
}
}

body = jsonencode({
body = {
kind = "Hub"
properties = {
applicationInsights = var.application_insights_id
Expand Down Expand Up @@ -53,12 +53,14 @@ resource "azapi_resource" "ai_studio_hub" {
name = "Basic"
tier = "Basic"
}
})
}

response_export_values = []
schema_validation_enabled = false # Can be reverted once this is closed: https://github.com/Azure/terraform-provider-azapi/issues/524
locks = []
ignore_body_changes = ["properties.managedNetwork"]
ignore_casing = false
ignore_missing_property = true
lifecycle {
ignore_changes = ["body.properties.managedNetwork"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "azapi_resource_action" "ai_studio_hub_provision_managed_network" {
count = var.ai_studio_hub_provision_managed_network ? 1 : 0

type = "Microsoft.MachineLearningServices/workspaces@2024-04-01"
resource_id = azapi_resource.ai_studio_hub.id

action = "provisionManagedNetwork"
method = "POST"
body = {
includeSpark = true
}

response_export_values = []
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "azapi_update_resource" "ai_studio_hub_outbound_rules" {
type = "Microsoft.MachineLearningServices/workspaces@2024-04-01"
resource_id = var.ai_studio_hub_id

body = jsonencode({
body = {
properties = {
managedNetwork = {
isolationMode = "AllowOnlyApprovedOutbound"
Expand All @@ -13,7 +13,7 @@ resource "azapi_update_resource" "ai_studio_hub_outbound_rules" {
}
}
}
})
}

response_export_values = []
locks = []
Expand All @@ -29,9 +29,9 @@ resource "azapi_resource_action" "ai_studio_hub_provision_managed_network" {

action = "provisionManagedNetwork"
method = "POST"
body = jsonencode({
body = {
includeSpark = true
})
}

response_export_values = []
depends_on = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "azapi_resource" "ai_studio_project_connection" {
name = each.key
parent_id = azapi_resource.ai_studio_project.id

body = jsonencode({
body = {
properties = {
authType = each.value.auth_type
category = each.value.category
Expand All @@ -15,8 +15,7 @@ resource "azapi_resource" "ai_studio_project_connection" {
target = each.value.target
metadata = each.value.metadata
}

})
}

response_export_values = []
schema_validation_enabled = false # Can be reverted once this is closed: https://github.com/Azure/terraform-provider-azapi/issues/524
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ resource "azapi_resource" "ai_studio_project" {
identity_ids = []
}

body = jsonencode({
body = {
kind = "Project"
properties = {
description = "AI Studio Project - ${var.ai_studio_project_name}"
friendlyName = title(replace(var.ai_studio_project_name, "-", " "))
hubResourceId = var.ai_studio_hub_id
}
})
}

response_export_values = []
schema_validation_enabled = false # Can be reverted once this is closed: https://github.com/Azure/terraform-provider-azapi/issues/524
Expand Down

0 comments on commit 6f01c8a

Please sign in to comment.