https://pulumi.com logo
Title
f

future-kite-91191

06/18/2020, 2:28 PM
I'm trying to do an ARM template deployment via Pulumi, using TS
TemplateDeployment
resource. I'm getting this error:
Error validating Template for Deployment "adyen-sa" (Resource Group "uel-dev-rg"): Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'Integer'. Actual 'String'. Please see <https://aka.ms/resource-manager-parameter-files> for usage details.'.
This is caused by the ARM template input parameters that some of them expect an integer as input. Problem is that
TemplateDeploymentArgs
has field
readonly parameters?: pulumi.Input<{
        [key: string]: pulumi.Input<string>;
    }>;
..that ony accepts string parameter values? Is there a way to use integer ARM template parameters with ``TemplateDeployment` ? Here's a sample of the ARM json template:
{
    "$schema": "<http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#>",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "OutputErrorPolicy": {
            "type": "string",
            "allowedValues": [
                "Drop",
                "Stop"
            ]
        },
        "EventsLateArrivalMaxDelayInSeconds": {
            "type": "int"
        },
        "EventsOutOfOrderMaxDelayInSeconds": {
            "type": "int"
        },
So here
EventsOutOfOrderMaxDelayInSeconds
parameter is of type
int
but in the Pulumi code I cannot use
const asa = new azure.core.TemplateDeployment("blabla", {

    name: "blabla",
    deploymentMode: "Incremental",
    resourceGroupName: resourceGroup.name,
    templateBody: fs.readFileSync("template.json").toString(),
    parameters: {
        "OutputErrorPolicy": "Stop",
        "EventsOutOfOrderMaxDelayInSeconds": 0,
        "EventsOutOfOrderPolicy": "Adjust",
        "StreamingUnits": "6",
This does not compile at the line
EventsOutOfOrderMaxDelayInSeconds": 0,
as
0
should be provided as a string
t

tall-librarian-49374

06/18/2020, 2:46 PM
I suppose the type for
parameters
is wrong then. Do you mind filing an issue? As a workaround, you should be able to pass
any
there, e.g.
"EventsOutOfOrderMaxDelayInSeconds": (any)0,
f

future-kite-91191

06/18/2020, 2:55 PM
The supported ARM template parameter types are "_string, securestring, int, bool, object, secureObject, and array_", see https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax#parameters
We are using VS Code extension for Azure Stream Analytics that generates the ARM templates
"EventsLateArrivalMaxDelayInSeconds": 5 as any,
does compile, but still returns error
Diagnostics:
  azure:core:TemplateDeployment (bla-sa):
    error: Error validating Template for Deployment "bla-sa" (Resource Group "uel-dev-rg"): Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'Integer'. Actual 'String'. Please see <https://aka.ms/resource-manager-parameter-files> for usage details.'.
t

tall-librarian-49374

06/18/2020, 3:07 PM
It looks like it’s a problem inside the Terraform provider: https://github.com/terraform-providers/terraform-provider-azurerm/issues/34
f

future-kite-91191

06/18/2020, 3:29 PM
Thanks for your feedback @tall-librarian-49374!