Skip to content

Commit

Permalink
fix: developer SKU doesn't deploy with null arrays (#2879)
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
-->

Closes #2561

* Default to empty arrays for `zones` and `additionalLocations` instead
of `null`.

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.api-management.service](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.yml/badge.svg)](https://github.com/tony-box/bicep-registry-modules/actions/workflows/avm.res.api-management.service.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: Tony Box <tobox@microsoft.com>
  • Loading branch information
tony-box and Tony Box authored Jul 31, 2024
1 parent 8fb0d25 commit 0698893
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions avm/res/api-management/service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ resource service 'Microsoft.ApiManagement/service@2023-05-01-preview' = {
name: sku
capacity: contains(sku, 'Consumption') ? 0 : contains(sku, 'Developer') ? 1 : skuCapacity
}
zones: contains(sku, 'Premium') ? zones : null
zones: contains(sku, 'Premium') ? zones : []
identity: identity
properties: {
publisherEmail: publisherEmail
publisherName: publisherName
notificationSenderEmail: notificationSenderEmail
hostnameConfigurations: hostnameConfigurations
additionalLocations: contains(sku, 'Premium') ? additionalLocations : null
additionalLocations: contains(sku, 'Premium') ? additionalLocations : []
customProperties: contains(sku, 'Consumption') ? null : customProperties
certificates: certificates
enableClientCertificate: enableClientCertificate ? true : null
Expand Down
6 changes: 3 additions & 3 deletions avm/res/api-management/service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "6395782495647847617"
"templateHash": "17801704016046413855"
},
"name": "API Management Services",
"description": "This module deploys an API Management Service. The default deployment is set to use a Premium SKU to align with Microsoft WAF-aligned best practices. In most cases, non-prod deployments should use a lower-tier SKU.",
Expand Down Expand Up @@ -590,14 +590,14 @@
"name": "[parameters('sku')]",
"capacity": "[if(contains(parameters('sku'), 'Consumption'), 0, if(contains(parameters('sku'), 'Developer'), 1, parameters('skuCapacity')))]"
},
"zones": "[if(contains(parameters('sku'), 'Premium'), parameters('zones'), null())]",
"zones": "[if(contains(parameters('sku'), 'Premium'), parameters('zones'), createArray())]",
"identity": "[variables('identity')]",
"properties": {
"publisherEmail": "[parameters('publisherEmail')]",
"publisherName": "[parameters('publisherName')]",
"notificationSenderEmail": "[parameters('notificationSenderEmail')]",
"hostnameConfigurations": "[parameters('hostnameConfigurations')]",
"additionalLocations": "[if(contains(parameters('sku'), 'Premium'), parameters('additionalLocations'), null())]",
"additionalLocations": "[if(contains(parameters('sku'), 'Premium'), parameters('additionalLocations'), createArray())]",
"customProperties": "[if(contains(parameters('sku'), 'Consumption'), null(), parameters('customProperties'))]",
"certificates": "[parameters('certificates')]",
"enableClientCertificate": "[if(parameters('enableClientCertificate'), true(), null())]",
Expand Down

0 comments on commit 0698893

Please sign in to comment.