Skip to content

Commit

Permalink
feat: support function app flex consumption plan (#3390)
Browse files Browse the repository at this point in the history
## Description

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes #123
Fixes #456
Closes #123
Closes #456
-->

#3389 
#3316 

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.web.site](https://github.com/pankajagrawal16/bicep-registry-modules/actions/workflows/avm.res.web.site.yml/badge.svg?branch=feat%2F3389%2Fsupport-function-app-config)](https://github.com/pankajagrawal16/bicep-registry-modules/actions/workflows/avm.res.web.site.yml)
[![avm.res.web.serverfarm](https://github.com/pankajagrawal16/bicep-registry-modules/actions/workflows/avm.res.web.serverfarm.yml/badge.svg?branch=feat%2F3389%2Fsupport-function-app-config)](https://github.com/pankajagrawal16/bicep-registry-modules/actions/workflows/avm.res.web.serverfarm.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [x] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [x] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [x] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
pankajagrawal16 authored Oct 7, 2024
1 parent 7ff2e41 commit 9510a28
Show file tree
Hide file tree
Showing 22 changed files with 136 additions and 80 deletions.
1 change: 1 addition & 0 deletions avm/res/web/serverfarm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ The name of the SKU will Determine the tier, size, family of the App Service Pla
'B1'
'P1v3'
'I1v2'
'FC1'
```

### Parameter: `tags`
Expand Down
4 changes: 3 additions & 1 deletion avm/res/web/serverfarm/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ param name string
'B1'
'P1v3'
'I1v2'
'FC1'
'''
})
param skuName string = 'P1v3'
Expand Down Expand Up @@ -129,7 +130,8 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
tags: tags
sku: {
name: skuName
capacity: skuCapacity
capacity: skuName == 'FC1' ? null : skuCapacity
tier: skuName == 'FC1' ? 'FlexConsumption' : null
}
properties: {
workerTierName: workerTierName
Expand Down
9 changes: 5 additions & 4 deletions avm/res/web/serverfarm/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.30.3.12046",
"templateHash": "12599229174633311842"
"version": "0.30.23.60470",
"templateHash": "489102920669919211"
},
"name": "App Service Plan",
"description": "This module deploys an App Service Plan.",
Expand Down Expand Up @@ -205,7 +205,7 @@
"type": "string",
"defaultValue": "P1v3",
"metadata": {
"example": " 'F1'\n 'B1'\n 'P1v3'\n 'I1v2'\n ",
"example": " 'F1'\n 'B1'\n 'P1v3'\n 'I1v2'\n 'FC1'\n ",
"description": "Optional. The name of the SKU will Determine the tier, size, family of the App Service Plan. This defaults to P1v3 to leverage availability zones."
}
},
Expand Down Expand Up @@ -379,7 +379,8 @@
"tags": "[parameters('tags')]",
"sku": {
"name": "[parameters('skuName')]",
"capacity": "[parameters('skuCapacity')]"
"capacity": "[if(equals(parameters('skuName'), 'FC1'), null(), parameters('skuCapacity'))]",
"tier": "[if(equals(parameters('skuName'), 'FC1'), 'FlexConsumption', null())]"
},
"properties": {
"workerTierName": "[parameters('workerTierName')]",
Expand Down
10 changes: 9 additions & 1 deletion avm/res/web/site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This module deploys a Web or Function App.
| `Microsoft.Web/sites/config` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/sites) |
| `Microsoft.Web/sites/extensions` | [2023-12-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/sites/extensions) |
| `Microsoft.Web/sites/hybridConnectionNamespaces/relays` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-09-01/sites/hybridConnectionNamespaces/relays) |
| `Microsoft.Web/sites/slots` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-09-01/sites/slots) |
| `Microsoft.Web/sites/slots` | [2023-12-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/sites/slots) |
| `Microsoft.Web/sites/slots/basicPublishingCredentialsPolicies` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/sites) |
| `Microsoft.Web/sites/slots/config` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/sites) |
| `Microsoft.Web/sites/slots/hybridConnectionNamespaces/relays` | [2022-09-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-09-01/sites/slots/hybridConnectionNamespaces/relays) |
Expand Down Expand Up @@ -3037,6 +3037,7 @@ param siteConfig = {
| [`diagnosticSettings`](#parameter-diagnosticsettings) | array | The diagnostic settings of the service. |
| [`enabled`](#parameter-enabled) | bool | Setting this value to false disables the app (takes the app offline). |
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`functionAppConfig`](#parameter-functionappconfig) | object | The Function App configuration object. |
| [`hostNameSslStates`](#parameter-hostnamesslstates) | array | Hostname SSL states are used to manage the SSL bindings for app's hostnames. |
| [`httpsOnly`](#parameter-httpsonly) | bool | Configures a site to accept only HTTPS requests. Issues redirect for HTTP requests. |
| [`hybridConnectionRelays`](#parameter-hybridconnectionrelays) | array | Names of hybrid connection relays to connect app with. |
Expand Down Expand Up @@ -3366,6 +3367,13 @@ Enable/Disable usage telemetry for module.
- Type: bool
- Default: `True`

### Parameter: `functionAppConfig`

The Function App configuration object.

- Required: No
- Type: object

### Parameter: `hostNameSslStates`

Hostname SSL states are used to manage the SSL bindings for app's hostnames.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "5861139703409371797"
"version": "0.30.23.60470",
"templateHash": "2961784489694025029"
},
"name": "Web Site Basic Publishing Credentials Policies",
"description": "This module deploys a Web Site Basic Publishing Credentials Policy.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/config--appsettings/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "3998275265127709875"
"version": "0.30.23.60470",
"templateHash": "10845600494881775271"
},
"name": "Site App Settings",
"description": "This module deploys a Site App Setting.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/config--authsettingsv2/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "15126303852151434516"
"version": "0.30.23.60470",
"templateHash": "9901606105705730734"
},
"name": "Site Auth Settings V2 Config",
"description": "This module deploys a Site Auth Settings V2 Configuration.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/config--logs/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "1719886395722436280"
"version": "0.30.23.60470",
"templateHash": "5314244939846396394"
},
"name": "Site logs Config",
"description": "This module deploys a Site logs Configuration.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/config--web/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "7195763436259190781"
"version": "0.30.23.60470",
"templateHash": "4796843420829841335"
},
"name": "Site Api Management Config",
"description": "This module deploys a Site Api Management Configuration.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/extensions--msdeploy/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "2006653133597094766"
"version": "0.30.23.60470",
"templateHash": "8769701913978391000"
},
"name": "Site Deployment Extension ",
"description": "This module deploys a Site extension for MSDeploy.",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/hybrid-connection-namespace/relay/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "7661794789768148013"
"version": "0.30.23.60470",
"templateHash": "1833159536134902561"
},
"name": "Web/Function Apps Hybrid Connection Relay",
"description": "This module deploys a Site Hybrid Connection Namespace Relay.",
Expand Down
5 changes: 5 additions & 0 deletions avm/res/web/site/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ param siteConfig object = {
alwaysOn: true
}

@description('Optional. The Function App configuration object.')
param functionAppConfig object?

@description('Optional. Required if app of kind functionapp. Resource ID of the storage account to manage triggers and logging function executions.')
param storageAccountResourceId string?

Expand Down Expand Up @@ -265,6 +268,7 @@ resource app 'Microsoft.Web/sites@2023-12-01' = {
keyVaultReferenceIdentity: keyVaultAccessIdentityResourceId
virtualNetworkSubnetId: virtualNetworkSubnetId
siteConfig: siteConfig
functionAppConfig: functionAppConfig
clientCertEnabled: clientCertEnabled
clientCertExclusionPaths: clientCertExclusionPaths
clientCertMode: clientCertMode
Expand Down Expand Up @@ -352,6 +356,7 @@ module app_slots 'slot/main.bicep' = [
storageAccountRequired: slot.?storageAccountRequired ?? storageAccountRequired
virtualNetworkSubnetId: slot.?virtualNetworkSubnetId ?? virtualNetworkSubnetId
siteConfig: slot.?siteConfig ?? siteConfig
functionAppConfig: slot.?functionAppConfig ?? functionAppConfig
storageAccountResourceId: slot.?storageAccountResourceId ?? storageAccountResourceId
storageAccountUseIdentityAuthentication: slot.?storageAccountUseIdentityAuthentication ?? storageAccountUseIdentityAuthentication
appInsightResourceId: slot.?appInsightResourceId ?? appInsightResourceId
Expand Down
Loading

0 comments on commit 9510a28

Please sign in to comment.