Skip to content

Commit

Permalink
fix: avm/res/web/serverfarm support for elasticScaleEnabled property (
Browse files Browse the repository at this point in the history
#2336)

## Description

Fixes #2335 

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



-->

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.web.serverfarm](https://github.com/pankajagrawal16/bicep-registry-modules/actions/workflows/avm.res.web.serverfarm.yml/badge.svg?branch=fix-enable-automatic-scale-support)](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.
- [ ] 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 -->

---------

Co-authored-by: Buddy <[email protected]>
  • Loading branch information
pankajagrawal16 and tsc-buddy authored Jun 16, 2024
1 parent e81ccdd commit 49dba51
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions avm/res/web/serverfarm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ module serverfarm 'br/public:avm/res/web/serverfarm:<version>' = {
| :-- | :-- | :-- |
| [`appServiceEnvironmentId`](#parameter-appserviceenvironmentid) | string | The Resource ID of the App Service Environment to use for the App Service Plan. |
| [`diagnosticSettings`](#parameter-diagnosticsettings) | array | The diagnostic settings of the service. |
| [`elasticScaleEnabled`](#parameter-elasticscaleenabled) | bool | Enable/Disable ElasticScaleEnabled App Service Plan. |
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`kind`](#parameter-kind) | string | Kind of server OS. |
| [`location`](#parameter-location) | string | Location for all resources. |
Expand Down Expand Up @@ -542,6 +543,14 @@ Resource ID of the diagnostic log analytics workspace. For security reasons, it
- Required: No
- Type: string

### Parameter: `elasticScaleEnabled`

Enable/Disable ElasticScaleEnabled App Service Plan.

- Required: No
- Type: bool
- Default: `[greater(parameters('maximumElasticWorkerCount'), 1)]`

### Parameter: `enableTelemetry`

Enable/Disable usage telemetry for module.
Expand Down
4 changes: 4 additions & 0 deletions avm/res/web/serverfarm/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ param workerTierName string = ''
@description('Optional. If true, apps assigned to this App Service plan can be scaled independently. If false, apps assigned to this App Service plan will scale to all instances of the plan.')
param perSiteScaling bool = false

@description('Optional. Enable/Disable ElasticScaleEnabled App Service Plan.')
param elasticScaleEnabled bool = maximumElasticWorkerCount > 1

@description('Optional. Maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan.')
param maximumElasticWorkerCount int = 1

Expand Down Expand Up @@ -136,6 +139,7 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
: null
perSiteScaling: perSiteScaling
maximumElasticWorkerCount: maximumElasticWorkerCount
elasticScaleEnabled: elasticScaleEnabled
reserved: reserved
targetWorkerCount: targetWorkerCount
targetWorkerSizeId: targetWorkerSize
Expand Down
12 changes: 10 additions & 2 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.27.1.19265",
"templateHash": "3135450909992165111"
"version": "0.28.1.47646",
"templateHash": "10906771261412134199"
},
"name": "App Service Plan",
"description": "This module deploys an App Service Plan.",
Expand Down Expand Up @@ -263,6 +263,13 @@
"description": "Optional. If true, apps assigned to this App Service plan can be scaled independently. If false, apps assigned to this App Service plan will scale to all instances of the plan."
}
},
"elasticScaleEnabled": {
"type": "bool",
"defaultValue": "[greater(parameters('maximumElasticWorkerCount'), 1)]",
"metadata": {
"description": "Optional. Enable/Disable ElasticScaleEnabled App Service Plan."
}
},
"maximumElasticWorkerCount": {
"type": "int",
"defaultValue": 1,
Expand Down Expand Up @@ -377,6 +384,7 @@
"hostingEnvironmentProfile": "[if(not(empty(parameters('appServiceEnvironmentId'))), createObject('id', parameters('appServiceEnvironmentId')), null())]",
"perSiteScaling": "[parameters('perSiteScaling')]",
"maximumElasticWorkerCount": "[parameters('maximumElasticWorkerCount')]",
"elasticScaleEnabled": "[parameters('elasticScaleEnabled')]",
"reserved": "[parameters('reserved')]",
"targetWorkerCount": "[parameters('targetWorkerCount')]",
"targetWorkerSizeId": "[parameters('targetWorkerSize')]",
Expand Down

0 comments on commit 49dba51

Please sign in to comment.