This Terraform configuration deploys an n8n instance on Azure Container Apps, along with an Azure OpenAI Service instance configured with the GPT-4o-mini model. By leveraging Azure Container Apps, this setup provides a cost-effective alternative to deploying n8n on Azure Kubernetes Service (AKS), as described on the n8n website. Azure Container Apps simplify the deployment process while maintaining scalability and reducing operational overhead.
- n8n Workflow Automation: Deploys n8n, a powerful workflow automation tool, in a highly available and scalable environment using Azure Container Apps.
- Optional Azure MCP Server Container: Optionally deploys an additional container app integrated with MCP/Azure, providing Azure-specific context to the agent in n8n. This container app includes an NGINX instance configured as a reverse proxy to the MCP server, ensuring seamless communication and enhanced functionality.
- Azure OpenAI Integration: Provisions an Azure OpenAI Service instance with the GPT-4o-mini model, enabling advanced AI capabilities for your workflows.
- Cost Optimization: Utilizes Azure Container Apps to minimize costs compared to AKS, making it an ideal choice for small to medium-scale deployments.
- Secure Configuration: Integrates with Azure Key Vault to securely manage sensitive information, such as API keys and secrets.
- Customizable Deployment: Supports flexible configuration options for region, tags, and telemetry, allowing you to tailor the deployment to your specific needs.
- Azure Verified Modules: Leverages Azure Verified Modules (AVMs) to ensure the use of well-defined, tested, and Microsoft-supported modules, enhancing reliability and maintainability.
This repository was created to provide a more affordable and accessible way to host n8n in the Azure cloud, as the AKS-based solution was found to be expensive for smaller-scale use cases. This configuration offers a practical alternative, combining the power of n8n and Azure OpenAI with the cost-efficiency and simplicity of Azure Container Apps.
Name | Version |
---|---|
terraform | ~> 1.11 |
azurerm | >= 4, < 5.0.0 |
random | ~> 3.7 |
Name | Version |
---|---|
azurerm | 4.26.0 |
random | 3.7.1 |
Name | Source | Version |
---|---|---|
container_app_mcp | Azure/avm-res-app-containerapp/azurerm | 0.4.0 |
container_app_n8n | Azure/avm-res-app-containerapp/azurerm | 0.4.0 |
key_vault | Azure/avm-res-keyvault-vault/azurerm | 0.10.0 |
naming | Azure/naming/azurerm | 0.4.0 |
openai | Azure/avm-res-cognitiveservices-account/azurerm | 0.7.0 |
postgresql | Azure/avm-res-dbforpostgresql-flexibleserver/azurerm | 0.1.4 |
storage | Azure/avm-res-storage-storageaccount/azurerm | 0.5.0 |
Name | Type |
---|---|
azurerm_container_app_environment.this | resource |
azurerm_container_app_environment_storage.this | resource |
azurerm_resource_group.this | resource |
azurerm_user_assigned_identity.this | resource |
random_password.myadminpassword | resource |
azurerm_client_config.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
deploy_mcp | This variable controls whether or not the MCP container app is deployed. If it is set to true, then the MCP container app will be deployed. |
bool |
false |
no |
enable_telemetry | This variable controls whether or not telemetry is enabled for the module. For more information see https://aka.ms/avm/telemetryinfo. If it is set to false, then no telemetry will be collected. |
bool |
false |
no |
location | Azure region where the resource should be deployed. If null, the location will be inferred from the resource group location. |
string |
"eastu2" |
no |
subscription_id | Azure Subscription ID | string |
n/a | yes |
tags | Custom tags to apply to the resource. | map(string) |
null |
no |
Name | Description |
---|---|
mcp_endpoint_sse | The sse endpoint of the MCP Server |
n8n_fqdn_url | https url that contains ingress's fqdn, could be used to access the n8n app. |
openai_api_version | The version of the OpenAI API to n8n credential. See https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation |
openai_deployment_name | The name of the OpenAI deployment. |
openai_endpoint | The endpoint of the OpenAI deployment. |
openai_key_secret_url | https url that contains the openai key secret in the key vault. |
openai_resource_name | The name of the OpenAI deployment. |