Search code examples
terraformazure-rm-templateterraform-provider-azureazure-rm

azurerm_resource_group_template_deployment ignoring parameter file


I am attempting to use terraform and embedded ARM templates to permit creating a simple logic app in Azure. I have the resource block in terraform as:

resource "azurerm_resource_group_template_deployment" "templateTEST" {
  name                = "arm-Deployment"
  resource_group_name = azurerm_resource_group.rg.name
  deployment_mode     = "Incremental" 
  template_content    = file("${path.module}/arm/createLogicAppsTEST.json")
  parameters_content = jsonencode({ 
    logic_app_name = { value = "logic-${var.prefix}" }
  })

}

and the createLogicAppsTEST.json file is defined (just the top few lines as)

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "logic_app_name": {
            "defaultValue": "tsa-logic-dgtlbi-stage-001",
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
....

When deploying and running the first time, ie. creating the logic app resource using terraform and the embedded ARM template, it will create passing the name correctly given the:

  parameters_content = jsonencode({ 
    logic_app_name = { value = "logic-${var.prefix}" }
  })

however, if I ever run again, terraform appears to ignore the parameters I am passing and goes with the default from the ARM template as:

    "logic_app_name": {
        "defaultValue": "tsa-logic-dgtlbi-stage-001",
        "type": "string"
    }

I have updated to the latest version of both terraform (0.14.2) and azurerm (2.40.0), yet the issue persists. At present, this kind of makes ARM in terraform problematic given different tiers, dev, test and prod at my company have different prefixes and names ie. prod-, dev-.

Is there a setting to make terraform actually use the parameters I am passing with azurerm_resource_group_template_deployment resource block?


Solution

  • I elected to just use the old provider, there is actually an open bug report about this same issue on github