Pass variable from ARM template to Terraform

590 views Asked by At

I want to pass output from ARM template to Terraform. Output ARM

        "logicAppUrl": {
             "type": "string",
            "value": "[parameters('workflows_adf_sb_ml_name')]"
         } 
    }

Output terraform

resource "azurerm_template_deployment" "adf-sb-ml" {
  name                = "adf-sb-ml"
  resource_group_name = var.rg

  depends_on = [
    null_resource.config
  ]

  template_body = file("upload_files/adf-sb-ml.json")

  parameters = {
    "connections_servicebus_name" = "servicebus"
    "workflows_adf_sb_ml_name" = "adf-sb-ml"

  }

  deployment_mode = "Incremental"

}

output "appid" {
  value = "${lookup(azurerm_template_deployment.adf-sb-ml.outputs, "logicAppUrl")}"
}

But I have error when run my code

in output "appid": 2020-09-29T18:40:40.8713191Z 2: value = "${[4mlookup([0mazurerm_template_deployment.adf-sb-ml.outputs, "logicAppUrl")}" 2020-09-29T18:40:40.8713804Z [0m
[90m|----------------[0m 2020-09-29T18:40:40.8714398Z [0m
[90m|[0m [1mazurerm_template_deployment.adf-sb-ml.outputs[0m is empty map of string[0m 2020-09-29T18:40:40.8714829Z [0m 2020-09-29T18:40:40.8715289Z Call to function "lookup" failed: lookup failed to find 'logicAppUrl'.

1

There are 1 answers

0
Nancy On

I have a short test with your code, it works. It should work on your side or you can check if the ARM template can deploy separately without included the Terraform or you can upgrade your terraform provider to the latest version.

enter image description here