Lets look at creating an Azure Logic App with a consumption plan using Terraform. Azure Logic Apps are a cloud service that allows you to automate workflows, business processes, and integrations across various services.
Why the Consumption plan?
I like using this plan as it offers the pay-per-execution pricing model. I use it for Logic Apps that run scheduled, usually on a weekly or monthly basis. This makes it very cost effective!
Terraform
In this Terraform setup we will:
- Create Logic App with Consumption Plan
- Create Managed Identity and associate to the Logic App
Lets create the Resource Group and associated Managed Identity that will be used
resource "azurerm_resource_group" "tamopsrg" {
name = "tamops-logicapps-rg"
location = "Uk South"
}
resource "azurerm_user_assigned_identity" "tamops-logicapp-mi" {
resource_group_name = azurerm_resource_group.tamopsrg.name
location = azurerm_resource_group.tamopsrg.location
name = "tamops-logicapp-mi"
}
Now add the Logic App with Consumption Plan – along with associating the Managed Identity to it
resource "azurerm_logic_app_workflow" "tamops-logicapp" {
name = "tamopslogicapp1"
location = azurerm_resource_group.tamopsrg.location
resource_group_name = azurerm_resource_group.tamopsrg.name
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.tamops-logicapp-mi.id]
}
depends_on = [azurerm_user_assigned_identity.tamops-logicapp-mi]
}
- The
azurerm_logic_app_workflowresource is used to create a Logic App with a Consumption plan. - We associate a user-assigned managed identity with the Logic App for enhanced security and access control.
- The
depends_onattribute ensures that the managed identity is created before the Logic App.
Awesome, creating in the Portal we can see the Azure resources have been created successfully:

The Managed Identity has also been associated to the Logic App successfully:

Creating Azure Logic Apps with Consumption plans using Terraform allows for efficient, repeatable deployments of your workflow automation solutions. This approach lets you version control your Logic App configurations and manage them alongside your other Azure resources