Thank you very much for your help @Vinay B, it worked! Based on your suggestion, instead of using a blob storage to store the JSON file, for saving costs purpose, I placed the content directly into the template using template_content with jsonencode. Here's the working solution for me:
resource "azurerm_resource_group_template_deployment" "webpubsub" {
name = "WebPubSubDeployment-${var.environment}"
resource_group_name = azurerm_resource_group.wps-rg.name
deployment_mode = "Incremental"
template_content = jsonencode({
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"webPubSubName": {
"type": "string",
"defaultValue": "cca-${var.EnvironmentShort}"
},
"location": {
"type": "string",
"defaultValue": "westeurope"
}
},
"resources": [
{
"type": "Microsoft.SignalRService/WebPubSub",
"apiVersion": "2024-10-01-preview",
"name": "[parameters('webPubSubName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Free_F1",
"tier": "Free",
"size": "F1",
"capacity": 1
},
"kind": "SocketIO",
"properties": {
"tls": {
"clientCertEnabled": false
},
"publicNetworkAccess": "Enabled",
"disableLocalAuth": false,
"disableAadAuth": false,
"regionEndpointEnabled": "Enabled",
"resourceStopped": "false"
}
}
]
})
parameters_content = jsonencode({
"webPubSubName": {
"value": "cca-${var.EnvironmentShort}"
},
"location": {
"value": "westeurope"
}
})
}