Skip to content

Commit

Permalink
Update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
oZakari committed Dec 13, 2024
1 parent d347d47 commit 05b241c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
16 changes: 14 additions & 2 deletions avm/res/kusto/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -165,6 +165,10 @@ module cluster 'br/public:avm/res/kusto/cluster:<version>' = {
{
kind: 'ReadWrite'
name: 'myReadWriteDatabase'
readWriteProperties: {
hotCachePeriod: 'P1D'
softDeletePeriod: 'P7D'
}
}
{
kind: 'ReadOnlyFollowing'
Expand Down Expand Up @@ -272,7 +276,11 @@ module cluster 'br/public:avm/res/kusto/cluster:<version>' = {
"value": [
{
"kind": "ReadWrite",
"name": "myReadWriteDatabase"
"name": "myReadWriteDatabase",
"readWriteProperties": {
"hotCachePeriod": "P1D",
"softDeletePeriod": "P7D"
}
},
{
"kind": "ReadOnlyFollowing",
Expand Down Expand Up @@ -395,6 +403,10 @@ param databases = [
{
kind: 'ReadWrite'
name: 'myReadWriteDatabase'
readWriteProperties: {
hotCachePeriod: 'P1D'
softDeletePeriod: 'P7D'
}
}
{
kind: 'ReadOnlyFollowing'
Expand Down
4 changes: 2 additions & 2 deletions avm/res/kusto/cluster/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
]
Expand Down
12 changes: 5 additions & 7 deletions avm/res/kusto/cluster/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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')]",
Expand Down Expand Up @@ -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#",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions avm/res/kusto/cluster/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ module testDeployment '../../../main.bicep' = [
{
name: 'myReadWriteDatabase'
kind: 'ReadWrite'
readWriteProperties: {
softDeletePeriod: 'P7D'
hotCachePeriod: 'P1D'
}
}
{
name: 'myReadOnlyDatabase'
Expand Down

0 comments on commit 05b241c

Please sign in to comment.