'Best approach to deploy logic app with workflow using terraform and arm templates?
I am planning to provision the logic app using terraform script. But the workflow of logic app, I am deploying through the arm templates.
Is this recommended approach?
Can anyone suggest me how to deploy the logic app with business flow?
Solution 1:[1]
Logic apps are kind of counter-intuitive when it comes to Terraform. It is an Azure service that is designed to abstract away custom coding with an easy-to-use user interface. Designing something in a user interface often does not work well when using multiple environments (e.g. test, staging, production). This conflicts heavily with one of the main purposes of Terraform: matching infrastructure across multiple environments.
Of course, you can turn to the magic of ARM templates, but mankind did not invent JSON to be readable. And Azure never had a plan to support YAML for ARM templates. So how to proceed from here? I set out our requirements, solution and a terraform example below.
Requirements
- Infrastructure is deployed by Terraform.
- Infrastructure is deployed in 4 matching environments (i.e. dev, tst, acc, prd).
- Configuring parameters for logic apps should be an easy task.
- Building logic apps is done in the GUI.
Solution
- Create an "empty" logic app resource with
azurerm_logic_app_workflow. This resource will be deployed across all environments. It is empty, so you will find the Logic App in the Azure Portal without any content. This means that in your dev environment, you can use the GUI to design the Logic App. - Create a resource which
azurerm_resource_group_template_deploymentwhich will only be deployed based on a condition. This condition is true when you supply an arm template path, which will not be the case in the dev environment. - Make sure that
azurerm_resource_group_template_deploymentdepends onazurerm_logic_app_workflowand setdeployment_mode = "Incremental". Furthermore you can supply parameters to the logic app by settingparameters_content = jsonencode(var.parameters_map).
Example
A working terraform example can be found on Github.
Note: another high-level Azure service is Data Factory, which faces the same problems when it comes to automatic deployments using Terraform.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nebulastic |
