Giter Club home page Giter Club logo

terraform-azurerm-functionapp's Introduction

Terraform module for Azure FunctionApp ⚡️

Deploy a function app on Azure with minimal configuration

Features

  • Create resource group, storage account and service plan automatically
  • Use name for all created resources by default, allowing custom values to be defined
  • Automatically set up deployment via local git repo and expose as git_url output
  • By default deactivate client_affinity and activate always_on (dedicated plans only)
  • Single parameter to start app in consumption plan plan_type = consumption
  • Customize all the things ✨

Usage

🚨 Note: As Terraform and ARM do not natively support enabling local git deployment this module uses the az CLI for that. This means you need to have az installed and a valid login token when running Terraform. If you set git_enabled = false you do not need either.

Deploy a function app in consumption plan with git deployment enabled:

module "myfunction" {
    source              = "anoff/functionapp/azurerm"
    name                = "myfunction"
    location            = "westeurope"
    plan_type           = "consumption"
}

Outputs:
git_url = myfunction.scm.azurewebsites:net:443/myfunction.git
name    = myfunction
id      = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/myfunction
outbound_ip_addresses = 52.23.25.3,52.143.43.12
default_hostname = myfunction.azurewebsites.net

Use a dedicated app plan with default settings and disabled git deployment:

module "myfunction" {
    source              = "anoff/functionapp/azurerm"
    location            = "westeurope"
    resource_group_name = "myresourcegroup"
    name                = "myfunction"
    plan_type           = "dedicated"
    git_enabled         = false
}

Outputs:
git_url = 
name    = myfunction
id      = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/myfunction
outbound_ip_addresses = 52.23.25.3,52.143.43.12
default_hostname = myfunction.azurewebsites.net

Custom dedicated plan with web sockets:

module "myfunction" {
    source              = "anoff/functionapp/azurerm"
    location            = "westeurope"
    resource_group_name = "myresourcegroup"
    name                = "myfunction"
    plan_type           = "dedicated"
    plan_settings {
        kind     = "Windows" # Linux or Windows
        size     = "S3"
        capacity = 4
    }
    site_config {
        always_on          = true
        websockets_enabled = true
    }
}

Changelog

v0.4.0

  • support site_config as variable, use this to set always_on property instead of the previous var.always_on

v0.3.0

v0.2.0

  • additional outputs on the module #2
  • use func_version as module parameter to define function version #3

v0.1.0

  • Set accound_kind to StorageV2
  • Enable encryption at rest & HTTPS traffic only

License

MIT © Andreas Offenhaeuser

terraform-azurerm-functionapp's People

Contributors

anoff 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.