From 05b241c10393ac61a85415195d3b6c97717537ae Mon Sep 17 00:00:00 2001 From: Zach Trocinski Date: Thu, 12 Dec 2024 20:28:15 -0600 Subject: [PATCH] Update logic --- avm/res/kusto/cluster/README.md | 16 ++++++++++++++-- avm/res/kusto/cluster/main.bicep | 4 ++-- avm/res/kusto/cluster/main.json | 12 +++++------- .../kusto/cluster/tests/e2e/max/main.test.bicep | 4 ++++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/avm/res/kusto/cluster/README.md b/avm/res/kusto/cluster/README.md index 6268610b5d..c010585ed9 100644 --- a/avm/res/kusto/cluster/README.md +++ b/avm/res/kusto/cluster/README.md @@ -18,7 +18,7 @@ This module deploys a Kusto Cluster. | `Microsoft.Authorization/locks` | [2020-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-05-01/locks) | | `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) | | `Microsoft.Insights/diagnosticSettings` | [2021-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Insights/2021-05-01-preview/diagnosticSettings) | -| `Microsoft.Kusto/clusters` | [2023-08-15](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Kusto/2023-08-15/clusters) | +| `Microsoft.Kusto/clusters` | [2024-04-13](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Kusto/2024-04-13/clusters) | | `Microsoft.Kusto/clusters/databases` | [2024-04-13](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Kusto/2024-04-13/clusters/databases) | | `Microsoft.Kusto/clusters/principalAssignments` | [2023-08-15](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Kusto/2023-08-15/clusters/principalAssignments) | | `Microsoft.Network/privateEndpoints` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints) | @@ -165,6 +165,10 @@ module cluster 'br/public:avm/res/kusto/cluster:' = { { kind: 'ReadWrite' name: 'myReadWriteDatabase' + readWriteProperties: { + hotCachePeriod: 'P1D' + softDeletePeriod: 'P7D' + } } { kind: 'ReadOnlyFollowing' @@ -272,7 +276,11 @@ module cluster 'br/public:avm/res/kusto/cluster:' = { "value": [ { "kind": "ReadWrite", - "name": "myReadWriteDatabase" + "name": "myReadWriteDatabase", + "readWriteProperties": { + "hotCachePeriod": "P1D", + "softDeletePeriod": "P7D" + } }, { "kind": "ReadOnlyFollowing", @@ -395,6 +403,10 @@ param databases = [ { kind: 'ReadWrite' name: 'myReadWriteDatabase' + readWriteProperties: { + hotCachePeriod: 'P1D' + softDeletePeriod: 'P7D' + } } { kind: 'ReadOnlyFollowing' diff --git a/avm/res/kusto/cluster/main.bicep b/avm/res/kusto/cluster/main.bicep index a24da68de4..2b1dfa226d 100644 --- a/avm/res/kusto/cluster/main.bicep +++ b/avm/res/kusto/cluster/main.bicep @@ -201,7 +201,7 @@ resource cMKKeyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = if (!empt } } -resource kustoCluster 'Microsoft.Kusto/clusters@2023-08-15' = { +resource kustoCluster 'Microsoft.Kusto/clusters@2024-04-13' = { name: name location: location tags: tags @@ -396,7 +396,7 @@ module kustoCluster_databases 'database/main.bicep' = [ name: database.name kustoClusterName: kustoCluster.name databaseKind: database.kind - databaseReadWriteProperties: database.readWriteProperties + databaseReadWriteProperties: database.kind == 'ReadWrite' ? database.readWriteProperties : null } } ] diff --git a/avm/res/kusto/cluster/main.json b/avm/res/kusto/cluster/main.json index c0a773dac0..0e4f6a08f1 100644 --- a/avm/res/kusto/cluster/main.json +++ b/avm/res/kusto/cluster/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.32.4.45862", - "templateHash": "5485047453025059126" + "templateHash": "9035944392764193312" }, "name": "Kusto Cluster", "description": "This module deploys a Kusto Cluster.", @@ -1134,7 +1134,7 @@ }, "kustoCluster": { "type": "Microsoft.Kusto/clusters", - "apiVersion": "2023-08-15", + "apiVersion": "2024-04-13", "name": "[parameters('name')]", "location": "[parameters('location')]", "tags": "[parameters('tags')]", @@ -2174,9 +2174,7 @@ "databaseKind": { "value": "[coalesce(parameters('databases'), createArray())[copyIndex()].kind]" }, - "databaseReadWriteProperties": { - "value": "[coalesce(parameters('databases'), createArray())[copyIndex()].readWriteProperties]" - } + "databaseReadWriteProperties": "[if(equals(coalesce(parameters('databases'), createArray())[copyIndex()].kind, 'ReadWrite'), createObject('value', coalesce(parameters('databases'), createArray())[copyIndex()].readWriteProperties), createObject('value', null()))]" }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", @@ -2369,7 +2367,7 @@ "metadata": { "description": "The principal ID of the system assigned identity." }, - "value": "[tryGet(tryGet(reference('kustoCluster', '2023-08-15', 'full'), 'identity'), 'principalId')]" + "value": "[tryGet(tryGet(reference('kustoCluster', '2024-04-13', 'full'), 'identity'), 'principalId')]" }, "name": { "type": "string", @@ -2383,7 +2381,7 @@ "metadata": { "description": "The location the resource was deployed into." }, - "value": "[reference('kustoCluster', '2023-08-15', 'full').location]" + "value": "[reference('kustoCluster', '2024-04-13', 'full').location]" }, "privateEndpoints": { "type": "array", diff --git a/avm/res/kusto/cluster/tests/e2e/max/main.test.bicep b/avm/res/kusto/cluster/tests/e2e/max/main.test.bicep index fe05e58159..92a4f18182 100644 --- a/avm/res/kusto/cluster/tests/e2e/max/main.test.bicep +++ b/avm/res/kusto/cluster/tests/e2e/max/main.test.bicep @@ -121,6 +121,10 @@ module testDeployment '../../../main.bicep' = [ { name: 'myReadWriteDatabase' kind: 'ReadWrite' + readWriteProperties: { + softDeletePeriod: 'P7D' + hotCachePeriod: 'P1D' + } } { name: 'myReadOnlyDatabase'