How can I implement the workflow within an Azure Logic App (Standard) using Terraform? I have exclusively utilized Terraform to deploy the Azure Logic App (Standard).

sonu verma 0 Reputation points
2024-02-28T08:50:00.68+00:00

Up until now, I've attempted to deploy the Azure Logic App using Azure ARM templates. This involved creating a separate template deployment job within my main Terraform file.

During the Terraform execution, when it initiates the deployment job in Azure, it encounters an error with the following message: ERROR TYPE: The requested resource does not support the HTTP method 'PUT'. Below, I've included sections from my main deployment template file and the workflow.json file for main.tf

resource "azurerm_logic_app_standard" "example" {   
name = var.logic_app_name   
location = data.azurerm_resource_group.existing.location   resource_group_name        = data.azurerm_resource_group.existing.name   app_service_plan_id        = azurerm_service_plan.example.id   storage_account_name       = azurerm_storage_account.example.name   storage_account_access_key = azurerm_storage_account.example.primary_access_key    

app_settings = {     FUNCTIONS_WORKER_RUNTIME     = "node"     FUNCTIONS_EXTENSION_VERSION = "~4"  # Update to the desired Node.js version   }
    identity {
     type = "SystemAssigned"   
} } 

resource "azurerm_resource_group_template_deployment" "workflow" {
  depends_on = [azurerm_logic_app_standard.example]
  name = "template_workflow_logic-app"
  deployment_mode     = "Incremental"
  resource_group_name = data.azurerm_resource_group.existing.name  
  template_content = file(local.workflow_path)
}


and below is my workflow.js file

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "name": "logic-app-name/workflow-name",
            "type": "Microsoft.Web/sites/workflows",
            "apiVersion": "2017-08-01",
            "location": "West Europe",
            "kind": "Stateful",
            "properties": {
                "files": {
                    "workflow.json": {
                        "definition": {
                            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                            "actions": {
                                "Process_Email_Queue_(POST)": {
                                    "type": "Http",
                                    "inputs": {
                                        "uri": "@parameters('process_email_queue_url')",
                                        "method": "POST",
                                        "headers": {
                                            "Authorization": "@{parameters('Bearer')} @{body('Fetch_body_for_access_token')?['access_token']}"
                                        }
                                    },
                                    "runAfter": {
                                        "Fetch_body_for_access_token": [
                                            "SUCCEEDED"
                                        ]
                                    },
                                    "runtimeConfiguration": {
                                        "contentTransfer": {
                                            "transferMode": "Chunked"
                                        }
                                    }
                                },
                                "Get_GAS-OIDC_bearer_token": {
                                    "type": "Http",
                                    "inputs": {
                                        "uri": "@parameters('GAS_OIDC_URL')",
                                        "method": "POST",
                                        "headers": {
                                            "Content-Type": "application/x-www-form-urlencoded"
                                        },
                                        "body": "@parameters('grant_type')",
                                        "authentication": {
                                            "type": "Basic",
                                            "username": "@{parameters('client_id')}",
                                            "password": "@{parameters('client_secret')}"
                                        }
                                    },
                                    "runAfter": {},
                                    "runtimeConfiguration": {
                                        "contentTransfer": {
                                            "transferMode": "Chunked"
                                        }
                                    }
                                },
                                "Fetch_body_for_access_token": {
                                    "type": "ParseJson",
                                    "inputs": {
                                        "content": "@body('Get_GAS-OIDC_bearer_token')",
                                        "schema": {
                                            "type": "object",
                                            "properties": {
                                                "access_token": {
                                                    "type": "string"
                                                },
                                                "token_type": {
                                                    "type": "string"
                                                },
                                                "expires_in": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    },
                                    "runAfter": {
                                        "Get_GAS-OIDC_bearer_token": [
                                            "SUCCEEDED"
                                        ]
                                    }
                                }
                            },
                            "contentVersion": "1.0.0.0",
                            "outputs": {},
                            "triggers": {
                                "Recurrence": {
                                    "type": "Recurrence",
                                    "recurrence": {
                                        "interval": 2,
                                        "frequency": "Minute"
                                    }
                                }
                            }
                        },
                        "kind": "Stateful"
                    }
                },
                "flowState": "Enabled",
                "health": {
                    "state": "Healthy"
                }
            }
        }
    ]
}

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,078 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.