Make Azure Logic Apps with Terraform, what are the limitations?
Asked Answered
F

3

7

For what I can understand one can build Logic Apps with Terraform. However, the docs are still not very good, and it looks like this feature is pretty new.

What are the limitations when it comes to TF and Azure Logic Apps? Are there any?

I want to build a two apps, one that is triggered every month and another that is triggered by a https request. I want these then to run two python scripts, and I want the later one to return the result from this script to the client that called the https.

Is this possible to automate in Terraform? At this moment, there are very little examples and documentation on this. Any comment or tip is helpful and greeted with open arms!

Forgat answered 18/9, 2018 at 21:7 Comment(0)
L
7

You can create a blank Logic App instance through Terrform (TF). But, if you want to add triggers and actions, I wouldn't recommend using TF at all, as of the provider version of 1.20.0.

  1. TF lacks document around parameters. As you know there are two parameters properties – right under the properties property and right under the definitions property. This document states parameters but it doesn't clearly say which one. I'm guessing this refers to the one under the definitions property, but it actually doesn't work – throws Invalid Template error without enough explanation.

    UPDATE: I just reverse engineered by importing a Logic App instance using terraform import. The parameters is actually pointing to the one under the properties property. However, it still doesn't work as the Logic App's parameter value can be anything – object, string, integer, etc, while TF's parameter expects string only. Also, there is no way to create parameters under the definitions property.

  2. TF only supports two triggers – HTTP trigger and Timer trigger. All other triggers should use the azurerm_logic_app_trigger_custom resource, but it requires the body part to manually write a JSON object or import from a file, which can't be parameterised through variables or locals.

  3. TF only supports one action – HTTP action. All other actions should use the azurerm_logic_app_action_custom resource, but, like the same issue above, it's not that useful.

In conclusion, TF lacks supports parameters, triggers and actions. So, unless you just create a blank Logic App instance, TF wouldn't be an option for Logic Apps. If you still want to create a blank Logic App instance with TF, then I would recommend this approach using Azure PowerShell or Azure CLI.

Ladyship answered 11/1, 2019 at 12:18 Comment(2)
For point 2, you can use a "template_file" resource, to generate the JSON, which can take variables or locals. See template_file Then you can do body = "${template_file.trigger_body.rendered}Diffluent
Thanks, I know this is a 4 years old post. Any idea if Terraform has improved now for creating Logic Apps now?Borgia
T
1

For clarity, you don't use Terraform to create LogicApps. LogicApps are designed in either the Portal or Visual Studio.

Terraform is a deployment/management tool. You can almost surely deploy your LogicApps, and other resources, with Terraform, but they're are already created.

Tanbark answered 19/9, 2018 at 12:8 Comment(1)
that's not clarifying at all. OP is asking whether it's possible to automate logicapps deployment somehow.Disposed
H
0

isn't the point of terraform to stand up resources across various environments just by passing in -var environment=qa to create a qa instance of the logic app? prod? uat? marcplaypen? I was hoping to use terraform import to create the terraform file, then create multiple versions of it. I can do it, but not with any parameters, which breaks one of my 'actions'.

I was using a combo of terraform import and logic app code view. most of my actions are pretty much a combo of copying the json block for each action, and modifying based on the first entry of the 'body' of the action generated from terraform import.

Then setting up the dependencies manually based off of runAfter, which tells me what an action is dependent on.

but, it fails on parameters, complaining there's only these declared parameters for my definition are ''.'

Historicity answered 11/5, 2021 at 22:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.