0

I am trying to create a Azure logic App workfow using terraform. My module is defined as below :

  resource "azurerm_logic_app_workflow" "logic_app_workflow" {
  for_each            = var.logic_app_workflows
  name                = each.value["name"]
  location            = each.value["location"]
  resource_group_name = each.value["resource_group_name"]
  enabled             = each.value["enabled"]
  workflow_parameters = { for k,v in each.value["workflow_parameters"] : k =>jsonencode(v) } 
  tags               = each.value["logic_app_workflow_tags"]
}

and my variable is defined as below :

 variable "logic_app_workflows" {
  type = map(object({
    name                    = string
    location                = string
    resource_group_name     = string
    enabled                 = bool
    workflow_parameters     = any
    logic_app_workflow_tags = map(string)
  }))
}

My tfvars file looks like this :

logic_app_workflows = {
  logic_app_workflow1 = {
    name                = "test-logic"    
    location            = "canadacentral" 
    resource_group_name = "test-rg"       
    enabled             = true
    workflow_parameters = {
      connection = {
        defaultValue = {}
        type         = { type = "Object" }
      }
    }
    logic_app_workflow_tags = {
      applicationName = "Logic App workflow"
    }
  }
}

Error : enter image description here

lviswanath
  • 21
  • 4

1 Answers1

0

I also received the same error when I tried your code in my environment.

enter image description here

The issue is with the connection type parameter in terraform.tfvars file. The type of the connection workflow parameters should be in the format type = "Object"because type = { type = "Object" } is not valid json string according to the workflow_parameters.

I modified tfvars file as shown:

logic_app_workflows = {
  logic_app_workflow1 = {
    name                = "test-logic"    
    location            = "canadacentral" 
    resource_group_name = "Jahnavi"      
    enabled             = true
    workflow_parameters = {
      connection = {
        defaultValue = {}
        type         = "Object" 
      }
    }
    logic_app_workflow_tags = {
      applicationName = "Logic App workflow"
    }
  }
}

enter image description here

Apply completed:

enter image description here

Deployed and viewed in Portal:

enter image description here

Jahnavi
  • 3,076
  • 1
  • 3
  • 10