Giter VIP home page Giter VIP logo

terraform-azurerm-function-app-with-plan's Introduction

Azure Function App with plan

Changelog Notice Apache V2 License TF Registry

This Terraform feature creates an Azure Function App with its App Service Plan, a consumption plan by default. A Storage Account and an Application Insights are required and are created if not provided.

Azure Functions v3 are now supported by this module and is the default one.

Version compatibility

Module version Terraform version AzureRM version
>= 4.x.x 0.13.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Limitations

Based on a current limitation, you cannot mix Windows and Linux apps in the same resource group.

Limitations documentation: docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro#limitations

Due to a bug introduced in AzureRM v2.18.0, you need to force the version to 2.17.0 if you want to create a Linux FunctionApp. GitHub Issue

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module.

More details about variables set by the terraform-wrapper available in the documentation.

You can use this module by including it this way:

Windows

module "azure-region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location     = module.azure-region.location
  client_name  = var.client_name
  environment  = var.environment
  stack        = var.stack
}

module "function_app" {
  source  = "claranet/function-app-with-plan/azurerm"
  version = "x.x.x"

  client_name         = var.client_name
  environment         = var.environment
  stack               = var.stack
  resource_group_name = module.rg.resource_group_name
  location            = module.azure-region.location
  location_short      = module.azure-region.location_short

  name_prefix = "hello"
  
  app_service_plan_os = "Windows"

  function_app_application_settings = {
    "tracker_id"      = "AJKGDFJKHFDS"
    "backend_api_url" = "https://backend.domain.tld/api"
  }

  extra_tags = {
    foo = "bar"
  }
}

Linux

module "azure-region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location     = module.azure-region.location
  client_name  = var.client_name
  environment  = var.environment
  stack        = var.stack
}

module "function_app" {
  source  = "claranet/function-app-with-plan/azurerm"
  version = "x.x.x"

  client_name         = var.client_name
  environment         = var.environment
  stack               = var.stack
  resource_group_name = module.rg.resource_group_name
  location            = module.azure-region.location
  location_short      = module.azure-region.location_short

  name_prefix = "hello"
  
  app_service_plan_os         = "Linux"
  function_language_for_linux = "python"
  function_app_version        = 3

  function_app_application_settings = {
    "tracker_id"      = "AJKGDFJKHFDS"
    "backend_api_url" = "https://backend.domain.tld/api"
  }

  extra_tags = {
    foo = "bar"
  }
}

Inputs

Name Description Type Default Required
app_service_plan_custom_name Custom name for app service plan string "" no
app_service_plan_extra_tags Extra tags to add to App Service Plan map(string) {} no
app_service_plan_name_prefix App Service Plan name prefix string "" no
app_service_plan_os App Service Plan OS for dedicated plans, can be "Linux" or "Windows" string n/a yes
app_service_plan_reserved Flag indicating if dedicated App Service Plan should be reserved string "false" no
app_service_plan_sku App Service Plan sku if created, consumption plan by default map(string)
{
"size": "Y1",
"tier": "Dynamic"
}
no
application_insights_custom_name Custom name for application insights deployed with function app string "" no
application_insights_enabled Enable or disable the Application Insights deployment bool true no
application_insights_extra_tags Extra tags to add to Application Insights map(string) {} no
application_insights_id ID of the existing Application Insights to use instead of deploying a new one. string null no
application_insights_name_prefix Application Insights name prefix string "" no
application_insights_type Application Insights type if need to be generated string "web" no
client_name n/a string n/a yes
environment n/a string n/a yes
extra_tags Extra tags to add map(string) {} no
function_app_application_settings Function App application settings map(string) {} no
function_app_custom_name Custom name for function app string "" no
function_app_extra_tags Extra tags to add to Function App map(string) {} no
function_app_name_prefix Function App name prefix string "" no
function_app_os_type A string indicating the Operating System type for this function app. string null no
function_app_site_config Site config for App Service. See documentation https://www.terraform.io/docs/providers/azurerm/r/app_service.html#site_config. IP restriction attribute is not managed in this block. any {} no
function_app_version Version of the function app runtime to use (Allowed values 2 or 3) number 3 no
function_language_for_linux Language of the Function App on Linux hosting, can be "dotnet", "node" or "python" string "dotnet" no
identity_ids UserAssigned Identities ID to add to Function App. Mandatory if type is UserAssigned list(string) null no
identity_type Add an Identity (MSI) to the function app. Possible values are SystemAssigned or UserAssigned string null no
location Azure location for Function App and related resources string n/a yes
location_short Short string for Azure location string n/a yes
name_prefix Name prefix for all resources generated name string "" no
resource_group_name n/a string n/a yes
stack n/a string n/a yes
storage_account_extra_tags Extra tags to add to Storage Account map(string) {} no
storage_account_name Name of the storage account to create with FunctionApp string null no
storage_account_name_prefix Storage Account name prefix string "" no

Outputs

Name Description
app_service_plan_id Id of the created App Service Plan
app_service_plan_name Name of the created App Service Plan
application_insights_app_id App id of the associated Application Insights
application_insights_application_type Application Type of the associated Application Insights
application_insights_id Id of the associated Application Insights
application_insights_instrumentation_key Instrumentation key of the associated Application Insights
application_insights_name Name of the associated Application Insights
function_app_connection_string Connection string of the created Function App
function_app_id Id of the created Function App
function_app_identity Identity block output of the Function App
function_app_name Name of the created Function App
function_app_outbound_ip_addresses Outbound IP adresses of the created Function App
storage_account_id Id of the associated Storage Account, empty if connection string provided
storage_account_name Name of the associated Storage Account, empty if connection string provided
storage_account_primary_access_key Primary connection string of the associated Storage Account, empty if connection string provided
storage_account_primary_connection_string Primary connection string of the associated Storage Account, empty if connection string provided
storage_account_secondary_access_key Secondary connection string of the associated Storage Account, empty if connection string provided
storage_account_secondary_connection_string Secondary connection string of the associated Storage Account, empty if connection string provided

Related documentation

Microsoft Azure Functions documentation: github.com/Azure/Azure-Functions#documentation-1

terraform-azurerm-function-app-with-plan's People

Contributors

bzspi avatar jmapro avatar shr3ps avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.