Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AVM Module Issue]: Setting up 'AvailabilityZones' is not supported in Sku :'Developer' #2561

Closed
1 task done
dewolfs opened this issue Jun 27, 2024 · 9 comments · Fixed by #2565 or #2879
Closed
1 task done
Assignees
Labels
Class: Resource Module 📦 This is a resource module Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: Bug 🐛 Something isn't working

Comments

@dewolfs
Copy link

dewolfs commented Jun 27, 2024

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Feature Request

Module Name

avm/res/api-management/service

(Optional) Module Version

0.2.0

Description

Hi,

I want to deploy an APIM instance in the SKU "Developer". The Developer SKU defaults to 1 instance count.

When the following bicep code is used:

module apim 'br/public:avm/res/api-management/service:0.2.0' = {
  name: 'apim9999'
  params: {
    name: 'testapim9999'
    publisherEmail: publisherEmail
    publisherName: publisherName
    virtualNetworkType: 'Internal'
    subnetResourceId: subnetRef.id
    location: location
    sku: 'Developer'
    ....
  }
}

i get the error:

[{"code":"NotSupported","message":"Setting up 'AvailabilityZones' is not supported in Sku :'Developer'.

If I look at the module, the SKU parameter will always be 2 if I choose Developer. But technically that's not possible ?!


capacity: contains(sku, 'V2') ? 1 : contains(sku, 'Consumption') ? 0 : skuCount

How to proceed to deploy APIM with the Developer SKU ?

(Optional) Correlation Id

No response

@dewolfs dewolfs added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Jun 27, 2024
@avm-team-linter avm-team-linter bot added the Class: Resource Module 📦 This is a resource module label Jun 27, 2024
Copy link

@dewolfs, thanks for submitting this issue for the avm/res/api-management/service module!

Important

A member of the @Azure/avm-res-apimanagement-service-module-owners-bicep or @Azure/avm-res-apimanagement-service-module-contributors-bicep team will review it soon!

@dhayes-ccl
Copy link

I'm having the same problem,
The AVM flavour fails to deploy with an Availability Zones error, the direct resource version deploys properly

var subnetResourceId = resourceId(networkResourceGroup,'Microsoft.Network/virtualNetworks/subnets', vnetName, subnetName)
var uniqueId = uniqueString(resourceGroup().id, 'apim')
module apim 'br/public:avm/res/api-management/service:0.2.0' = {
name: 'apimDeployment'
params: {
name: 'apim-apim${uniqueId}'
publisherEmail: 'xxx'
publisherName: 'xxx'
sku:'Developer'
skuCount:1
subnetResourceId: subnetResourceId
virtualNetworkType:'Internal'
zones:null
additionalLocations:null
disableGateway:true
}
}

// resource apimService 'Microsoft.ApiManagement/service@2021-01-01-preview' = {
// name: 'apim-apim${uniqueId}'
// location: resourceGroup().location
// sku: {
// name: 'Developer'
// capacity: 1
// }
// properties: {
// publisherEmail: 'xxx'
// publisherName: 'xxx'
// virtualNetworkType: 'Internal'
// virtualNetworkConfiguration: {
// subnetResourceId: subnetResourceId
// }
// }
// }

@tony-box
Copy link
Contributor

Sorry for that, folks--definitely a bug. I am almost done with a fix and will be making a PR shortly.

@tony-box tony-box added Type: Bug 🐛 Something isn't working and removed Needs: Triage 🔍 Maintainers need to triage still Type: Feature Request ➕ New feature or request labels Jun 27, 2024
tony-box added a commit that referenced this issue Jul 24, 2024
## 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 

- Added tests for different SKUs to ensure no more issues in the future
- Disable some APIM PSRule tests that are $$ and not necessary for
non-prod deployments
- fix logic to ensure various SKUs can be deployed and use availability
zones and scale units

## 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?branch=fix%2F2561)](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>
@IngerMathilde
Copy link

Hi! Thanks for the fix! I see that it is still a problem in the latest available version 0.2.1. Any ETA when a new version will be released with this fix?

@dhayes-ccl
Copy link

dhayes-ccl commented Jul 30, 2024

@IngerMathilde this worked for me, I think the key was setting the zones and additional locations to [] explicitly. Hope this helps you

module apimService 'br/public:avm/res/api-management/service:0.2.1' = {
  name: 'apim-${apimName}-${uniqueId}'
  params: {
    name: 'apim-${apimName}-${uniqueId}'
    location: location
    sku: skuName
    skuCount: skuCount
    virtualNetworkType: 'Internal'
    subnetResourceId: subnetResourceId
    hostnameConfigurations: ( deployHostNames ? allHostNameConfigurations:gatewayHostNameConfigurations)
    publisherEmail: publisherEmail
    publisherName: publisherName
    zones: []
    additionalLocations: []
    diagnosticSettings: [
      {
        name: 'LogAnalytics'
        workspaceResourceId: lawWorkspaceId
        logCategoriesAndGroups: [
          {
            categoryGroup: 'allLogs'
          }
        ]
        metricCategories: [
          {
            category: 'AllMetrics'
          }
        ]
      }
    ]
    policies: [
      {
        format: 'xml'
        value: replace(policy, '\${apimDeveloperPortalUrl}', developerPortalUrl)
      }
    ]
    managedIdentities: {
      systemAssigned: false
      userAssignedResourceIds: [
        uai.id
      ]
    }
  }
}

@tony-box
Copy link
Contributor

@dhayes-ccl @IngerMathilde interesting... the test deployment for a Developer SKU deploys successfully using only the required params:

module testDeployment '../../../main.bicep' = [
  for iteration in ['init', 'idem']: {
    scope: resourceGroup
    name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}'
    params: {
      name: '${namePrefix}${serviceShort}001'
      location: resourceLocation
      publisherEmail: 'apimgmt-noreply@mail.windowsazure.com'
      publisherName: '${namePrefix}-az-amorg-x-001'
      sku: 'Developer'
    }
  }
]

I'm not sure why explicitly setting the skuCount would then require an empty array for zones and additionalLocations. I am going to test a quick fix to default those two arrays to [] instead of null to see if that results in the desired behavior of setting skuCount

@tony-box
Copy link
Contributor

@dhayes-ccl @IngerMathilde sorry--I just realized you two are using skuCount which was deprecated with the last minor update 0.2.0. The new param name is called skuCapacity which better aligns with the actual definition of what that parameter modifies.

Regardless, I am testing out using empty arrays instead of null arrays to see if that removes any issues if you explicitly set the skuCapacity to 1

@tony-box tony-box reopened this Jul 30, 2024
@IngerMathilde
Copy link

IngerMathilde commented Jul 30, 2024

@dhayes-ccl thanks this helped. Had zones and additionalLocations set to null and not empty arrays. @tony-box I am quite new to using azure verified modules, but If I look at the tag associated with the last release (https://github.com/Azure/bicep-registry-modules/blob/avm/res/api-management/service/0.2.1/avm/res/api-management/service/main.bicep), it is not up to date with main. That is why I was wondering if we needed a 0.2.2 version.

@tony-box
Copy link
Contributor

@IngerMathilde @dewolfs PR raised to fix the issue. deployment was successful when I set the skuCapacity to 1 for the developer sku without setting zones or additionalLocations params.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Class: Resource Module 📦 This is a resource module Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: Bug 🐛 Something isn't working
Projects
4 participants