I created a logic web app workflow with Terraform. I created correctly a trigger, and now I wanted to create an Action that send email. If I see the generated template everything looks good, but something I do not understand goes wrong.
I let you see the template generated of the action:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"send-email": {
"inputs": {
"body": {
"Body": "...",
"From": "...",
"Subject": "...",
"To": "..."
},
"host": {
"connection": {
"name": "/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Web/connections/zzz"
}
},
"method": "post",
"path": "/SendEmailV3"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"triggers": {...}
},
"parameters": {}
}
I let you see also what I see if I create the action by hand on portal azure:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Send_Email_(V3)": {
"inputs": {
"body": {
"Body": "...",
"From": "...",
"Subject": "...",
"To": "..."
},
"host": {
"connection": {
"name": "@parameters('$connections')['smtp']['connectionId']"
}
},
"method": "post",
"path": "/SendEmailV3"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {...}
},
"parameters": {
"$connections": {
"value": {
"smtp": {
"connectionId": "/subscriptions/xxx/resourceGroups/yyy/providers/Microsoft.Web/connections/zzz",
"connectionName": "smtp-5",
"id": "/subscriptions/xxx/providers/Microsoft.Web/locations/westeurope/managedApis/smtp"
}
}
}
}
}
As you can see above, the only difference is the parameters
block. If I create the action by hand, the portal generate the parameters and then it references the connection in the host.connection.name
.
Instead, I simply set the connection name in the host.connection.name
.
In a pratical way it seems like there is no difference.
I tried also to set the workflow_paramters
in the azurerm_logic_app_workflow
but it is not clear how I must set the value. Here the doc I am trying to follow:
And here how I am trying to set the value:
workflow_parameters = [{
"$connections" = {
"type": "string",
"defaultValue": "${azurerm_api_connection.noreply_email_api.id}"
}
}
]
But this is the error I get:
Inappropriate value for attribute "workflow_parameters": map of string required.
Any idea how to set the connection in logic web app workflow? Thank you