Skip to content

Commit

Permalink
fix: Accelerated Network res/compute/gallery (#4432)
Browse files Browse the repository at this point in the history
## Description

Fixes accelerated networking property for `res/compute/gallery` module,
updates RP references and adds the new property allowUpdateImage.

Closes #4374 
references #4349 

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.compute.gallery](https://github.com/ReneHezser/bicep-registry-modules/actions/workflows/avm.res.compute.gallery.yml/badge.svg)](https://github.com/ReneHezser/bicep-registry-modules/actions/workflows/avm.res.compute.gallery.yml)
|

## Type of Change

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] 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`.
  - [ ] 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
  • Loading branch information
ReneHezser authored Feb 13, 2025
1 parent 8c3e3e9 commit b0c5aff
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 50 deletions.
59 changes: 56 additions & 3 deletions avm/res/compute/gallery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This module deploys an Azure Compute Gallery (formerly known as Shared Image Gal
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Notes](#Notes)
- [Data Collection](#Data-Collection)

## Resource Types
Expand All @@ -17,9 +18,9 @@ This module deploys an Azure Compute Gallery (formerly known as Shared Image Gal
| :-- | :-- |
| `Microsoft.Authorization/locks` | [2020-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-05-01/locks) |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.Compute/galleries` | [2023-07-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2023-07-03/galleries) |
| `Microsoft.Compute/galleries/applications` | [2022-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2022-03-03/galleries/applications) |
| `Microsoft.Compute/galleries/images` | [2023-07-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2023-07-03/galleries/images) |
| `Microsoft.Compute/galleries` | [2024-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2024-03-03/galleries) |
| `Microsoft.Compute/galleries/applications` | [2024-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2024-03-03/galleries/applications) |
| `Microsoft.Compute/galleries/images` | [2024-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2024-03-03/galleries/images) |

## Usage examples

Expand Down Expand Up @@ -144,6 +145,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
description: 'This is a test deployment.'
images: [
{
allowUpdateImage: true
architecture: 'x64'
description: 'testDescription'
endOfLife: '2033-01-01'
Expand All @@ -169,6 +171,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
releaseNoteUri: 'https://testReleaseNoteUri.com'
}
{
allowUpdateImage: false
hyperVGeneration: 'V2'
identifier: {
offer: 'WindowsServer'
Expand Down Expand Up @@ -215,6 +218,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
}
}
{
diskControllerType: 'SCSI'
hyperVGeneration: 'V2'
identifier: {
offer: '0001-com-ubuntu-minimal-focal'
Expand All @@ -235,6 +239,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
}
}
{
diskControllerType: 'SCSI, NVMe'
hyperVGeneration: 'V2'
identifier: {
offer: '0001-com-ubuntu-minimal-focal'
Expand Down Expand Up @@ -377,6 +382,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
"images": {
"value": [
{
"allowUpdateImage": true,
"architecture": "x64",
"description": "testDescription",
"endOfLife": "2033-01-01",
Expand All @@ -402,6 +408,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
"releaseNoteUri": "https://testReleaseNoteUri.com"
},
{
"allowUpdateImage": false,
"hyperVGeneration": "V2",
"identifier": {
"offer": "WindowsServer",
Expand Down Expand Up @@ -448,6 +455,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
}
},
{
"diskControllerType": "SCSI",
"hyperVGeneration": "V2",
"identifier": {
"offer": "0001-com-ubuntu-minimal-focal",
Expand All @@ -468,6 +476,7 @@ module gallery 'br/public:avm/res/compute/gallery:<version>' = {
}
},
{
"diskControllerType": "SCSI, NVMe",
"hyperVGeneration": "V2",
"identifier": {
"offer": "0001-com-ubuntu-minimal-focal",
Expand Down Expand Up @@ -610,6 +619,7 @@ param applications = [
param description = 'This is a test deployment.'
param images = [
{
allowUpdateImage: true
architecture: 'x64'
description: 'testDescription'
endOfLife: '2033-01-01'
Expand All @@ -635,6 +645,7 @@ param images = [
releaseNoteUri: 'https://testReleaseNoteUri.com'
}
{
allowUpdateImage: false
hyperVGeneration: 'V2'
identifier: {
offer: 'WindowsServer'
Expand Down Expand Up @@ -681,6 +692,7 @@ param images = [
}
}
{
diskControllerType: 'SCSI'
hyperVGeneration: 'V2'
identifier: {
offer: '0001-com-ubuntu-minimal-focal'
Expand All @@ -701,6 +713,7 @@ param images = [
}
}
{
diskControllerType: 'SCSI, NVMe'
hyperVGeneration: 'V2'
identifier: {
offer: '0001-com-ubuntu-minimal-focal'
Expand Down Expand Up @@ -1296,8 +1309,10 @@ Images to create.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`allowUpdateImage`](#parameter-imagesallowupdateimage) | bool | Must be set to true if the gallery image features are being updated. |
| [`architecture`](#parameter-imagesarchitecture) | string | The architecture of the image. Applicable to OS disks only. |
| [`description`](#parameter-imagesdescription) | string | The description of this gallery image definition resource. This property is updatable. |
| [`diskControllerType`](#parameter-imagesdiskcontrollertype) | string | The disk controllers that an OS disk supports. |
| [`endOfLife`](#parameter-imagesendoflife) | string | The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable. |
| [`eula`](#parameter-imageseula) | string | The Eula agreement for the gallery image definition. |
| [`excludedDiskTypes`](#parameter-imagesexcludeddisktypes) | array | Describes the disallowed disk types. |
Expand Down Expand Up @@ -1382,6 +1397,13 @@ This property allows you to specify the type of the OS that is included in the d
]
```

### Parameter: `images.allowUpdateImage`

Must be set to true if the gallery image features are being updated.

- Required: No
- Type: bool

### Parameter: `images.architecture`

The architecture of the image. Applicable to OS disks only.
Expand All @@ -1403,6 +1425,21 @@ The description of this gallery image definition resource. This property is upda
- Required: No
- Type: string

### Parameter: `images.diskControllerType`

The disk controllers that an OS disk supports.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'NVMe, SCSI'
'SCSI'
'SCSI, NVMe'
]
```

### Parameter: `images.endOfLife`

The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.
Expand Down Expand Up @@ -1772,6 +1809,22 @@ This section gives you an overview of all local-referenced module files (i.e., o
| :-- | :-- |
| `br/public:avm/utl/types/avm-common-types:0.3.0` | Remote reference |

## Notes

Currently it is not possible to redeploy the `image.diskControllerType` property with a value of `NVMe, SCSI`. The initial deployment is working, but other deployments will result in an error.

```json
"details": [
{
"code": "PropertyChangeNotAllowed",
"target": "DiskControllerTypes",
"message": "Changing property 'DiskControllerTypes' is not allowed."
}
]
```

Once this bug has been resolved, the max test will be updated to deploy an image with the property value.

## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
2 changes: 1 addition & 1 deletion avm/res/compute/gallery/application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This module deploys an Azure Compute Gallery Application.
| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.Compute/galleries/applications` | [2022-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2022-03-03/galleries/applications) |
| `Microsoft.Compute/galleries/applications` | [2024-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2024-03-03/galleries/applications) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions avm/res/compute/gallery/application/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ var formattedRoleAssignments = [
})
]

resource gallery 'Microsoft.Compute/galleries@2022-03-03' existing = {
resource gallery 'Microsoft.Compute/galleries@2024-03-03' existing = {
name: galleryName
}

resource application 'Microsoft.Compute/galleries/applications@2022-03-03' = {
resource application 'Microsoft.Compute/galleries/applications@2024-03-03' = {
name: name
parent: gallery
location: location
Expand Down
10 changes: 5 additions & 5 deletions avm/res/compute/gallery/application/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7761447372947910331"
"version": "0.33.93.31351",
"templateHash": "8421640590183520512"
},
"name": "Compute Galleries Applications",
"description": "This module deploys an Azure Compute Gallery Application."
Expand Down Expand Up @@ -281,12 +281,12 @@
"gallery": {
"existing": true,
"type": "Microsoft.Compute/galleries",
"apiVersion": "2022-03-03",
"apiVersion": "2024-03-03",
"name": "[parameters('galleryName')]"
},
"application": {
"type": "Microsoft.Compute/galleries/applications",
"apiVersion": "2022-03-03",
"apiVersion": "2024-03-03",
"name": "[format('{0}/{1}', parameters('galleryName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -350,7 +350,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference('application', '2022-03-03', 'full').location]"
"value": "[reference('application', '2024-03-03', 'full').location]"
}
}
}
27 changes: 25 additions & 2 deletions avm/res/compute/gallery/image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This module deploys an Azure Compute Gallery Image Definition.
| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.Compute/galleries/images` | [2023-07-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2023-07-03/galleries/images) |
| `Microsoft.Compute/galleries/images` | [2024-03-03](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Compute/2024-03-03/galleries/images) |

## Parameters

Expand All @@ -36,9 +36,11 @@ This module deploys an Azure Compute Gallery Image Definition.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`allowUpdateImage`](#parameter-allowupdateimage) | bool | Must be set to true if the gallery image features are being updated. |
| [`architecture`](#parameter-architecture) | string | The architecture of the image. Applicable to OS disks only. |
| [`description`](#parameter-description) | string | The description of this gallery image definition resource. This property is updatable. |
| [`disallowed`](#parameter-disallowed) | object | Describes the disallowed disk types. |
| [`diskControllerType`](#parameter-diskcontrollertype) | string | The disk controllers that an OS disk supports. |
| [`endOfLifeDate`](#parameter-endoflifedate) | string | The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable. |
| [`eula`](#parameter-eula) | string | The Eula agreement for the gallery image definition. |
| [`hyperVGeneration`](#parameter-hypervgeneration) | string | The hypervisor generation of the Virtual Machine. If this value is not specified, then it is determined by the securityType parameter. If the securityType parameter is specified, then the value of hyperVGeneration will be V2, else V1. |
Expand Down Expand Up @@ -132,6 +134,13 @@ The name of the parent Azure Shared Image Gallery. Required if the template is u
- Required: Yes
- Type: string

### Parameter: `allowUpdateImage`

Must be set to true if the gallery image features are being updated.

- Required: No
- Type: bool

### Parameter: `architecture`

The architecture of the image. Applicable to OS disks only.
Expand Down Expand Up @@ -179,6 +188,21 @@ A list of disk types.
]
```

### Parameter: `diskControllerType`

The disk controllers that an OS disk supports.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'NVMe, SCSI'
'SCSI'
'SCSI, NVMe'
]
```

### Parameter: `endOfLifeDate`

The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.
Expand Down Expand Up @@ -213,7 +237,6 @@ Specify if the image supports accelerated networking.

- Required: No
- Type: bool
- Default: `True`

### Parameter: `isHibernateSupported`

Expand Down
35 changes: 26 additions & 9 deletions avm/res/compute/gallery/image/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ param securityType (
| 'ConfidentialVMSupported')?

@sys.description('Optional. Specify if the image supports accelerated networking.')
param isAcceleratedNetworkSupported bool = true
param isAcceleratedNetworkSupported bool?

@sys.description('Optional. Specifiy if the image supports hibernation.')
param isHibernateSupported bool?

@sys.description('Optional. Must be set to true if the gallery image features are being updated.')
param allowUpdateImage bool?

@sys.description('Optional. The architecture of the image. Applicable to OS disks only.')
param architecture ('x64' | 'Arm64')?

Expand All @@ -70,6 +73,9 @@ param eula string?
@sys.description('Optional. The hypervisor generation of the Virtual Machine. If this value is not specified, then it is determined by the securityType parameter. If the securityType parameter is specified, then the value of hyperVGeneration will be V2, else V1.')
param hyperVGeneration ('V1' | 'V2')?

@sys.description('Optional. The disk controllers that an OS disk supports.')
param diskControllerType ('SCSI' | 'SCSI, NVMe' | 'NVMe, SCSI')?

@sys.description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType

Expand Down Expand Up @@ -113,16 +119,17 @@ var formattedRoleAssignments = [
})
]

resource gallery 'Microsoft.Compute/galleries@2023-07-03' existing = {
resource gallery 'Microsoft.Compute/galleries@2024-03-03' existing = {
name: galleryName
}

resource image 'Microsoft.Compute/galleries/images@2023-07-03' = {
resource image 'Microsoft.Compute/galleries/images@2024-03-03' = {
name: name
parent: gallery
location: location
tags: tags
properties: {
allowUpdateImage: allowUpdateImage != null ? allowUpdateImage : null
architecture: architecture
description: description
disallowed: {
Expand All @@ -131,12 +138,14 @@ resource image 'Microsoft.Compute/galleries/images@2023-07-03' = {
endOfLifeDate: endOfLifeDate
eula: eula
features: union(
[
{
name: 'IsAcceleratedNetworkSupported'
value: '${isAcceleratedNetworkSupported}'
}
],
(isAcceleratedNetworkSupported != null // Accelerated network is not set by default and must not be set for unsupported skus
? [
{
name: 'IsAcceleratedNetworkSupported'
value: '${isAcceleratedNetworkSupported}'
}
]
: []),
(securityType != null && securityType != 'Standard' // Standard is the default and is not set
? [
{
Expand All @@ -152,6 +161,14 @@ resource image 'Microsoft.Compute/galleries/images@2023-07-03' = {
value: '${isHibernateSupported}'
}
]
: []),
(diskControllerType != null
? [
{
name: 'DiskControllerTypes'
value: '${diskControllerType}'
}
]
: [])
)
hyperVGeneration: hyperVGeneration ?? (!empty(securityType ?? '') ? 'V2' : 'V1')
Expand Down
Loading

0 comments on commit b0c5aff

Please sign in to comment.