This repository provides a Terraform template to deploy Azure Functions and related resources.
- Terraform installed
- Azure CLI authenticated
terraform initterraform plan -var-file=dev.tfvars terraform apply -var-file=dev.tfvarsterraform plan -var-file=prod.tfvars terraform apply -var-file=prod.tfvarsIf you already have existing resources in Azure, you can import them into your Terraform state using the following commands. Replace placeholders (<SUB>, <sa-name>, etc.) with your actual values.
terraform import azurerm_resource_group.rg \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-coreterraform import azurerm_storage_account.sa \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/Microsoft.Storage/storageAccounts/<sa-name>terraform import azurerm_service_plan.sp \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/Microsoft.Web/serverfarms/<asp-name>terraform import azurerm_log_analytics_workspace.log_aw \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/Microsoft.OperationalInsights/workspaces/<ws-name>terraform import azurerm_application_insights.ai \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/microsoft.insights/components/<ai-name>terraform import azurerm_linux_function_app.az_linux \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/Microsoft.Web/sites/func-kha-dev-apiterraform import azurerm_function_app_function.az_func \ /subscriptions/<SUB>/resourceGroups/rg-kha-dev-core/providers/Microsoft.Web/sites/func-kha-dev-api/functions/example-function-app-functionFeel free to customize the variables and resource names as needed for your environment.