Skip to content

Commit

Permalink
feat: NetApp - Restructured as per ResourceType structure to & to ena…
Browse files Browse the repository at this point in the history
…ble additional capabilities (#4043)

## Description

- Restructured the deployment of backup to enable shared policies &
future child-module publishing
- Updated removal logic to handle backups
- Introduced numerous UDTs
- Aligned with several AVM specs (e.g., regarding naming)

Depends on #4204

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.net-app.net-app-account](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.net-app.net-app-account.yml/badge.svg?branch=users%2Falsehr%2FnetAppStructure&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.net-app.net-app-account.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:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] 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`.
  - [ ] Update to documentation
  • Loading branch information
AlexanderSehr authored Jan 27, 2025
1 parent 3f62007 commit 8ad13c9
Show file tree
Hide file tree
Showing 24 changed files with 8,989 additions and 4,184 deletions.
1,861 changes: 1,637 additions & 224 deletions avm/res/net-app/net-app-account/README.md

Large diffs are not rendered by default.

77 changes: 44 additions & 33 deletions avm/res/net-app/net-app-account/backup-policies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ This module deploys a Backup Policy for Azure NetApp File.

## Parameters

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`backupPolicyLocation`](#parameter-backuppolicylocation) | string | The location of the backup policy. Required if the template is used in a standalone deployment. |
| [`dailyBackupsToKeep`](#parameter-dailybackupstokeep) | int | The daily backups to keep. |
| [`monthlyBackupsToKeep`](#parameter-monthlybackupstokeep) | int | The monthly backups to keep. |
| [`weeklyBackupsToKeep`](#parameter-weeklybackupstokeep) | int | The weekly backups to keep. |

**Conditional parameters**

| Parameter | Type | Description |
Expand All @@ -35,12 +26,16 @@ This module deploys a Backup Policy for Azure NetApp File.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`backupEnabled`](#parameter-backupenabled) | bool | Indicates whether the backup policy is enabled. |
| [`backupPolicyName`](#parameter-backuppolicyname) | string | The name of the backup policy. |
| [`dailyBackupsToKeep`](#parameter-dailybackupstokeep) | int | The daily backups to keep. |
| [`enabled`](#parameter-enabled) | bool | Indicates whether the backup policy is enabled. |
| [`location`](#parameter-location) | string | The location of the backup policy. |
| [`monthlyBackupsToKeep`](#parameter-monthlybackupstokeep) | int | The monthly backups to keep. |
| [`name`](#parameter-name) | string | The name of the backup policy. |
| [`weeklyBackupsToKeep`](#parameter-weeklybackupstokeep) | int | The weekly backups to keep. |

### Parameter: `backupPolicyLocation`
### Parameter: `netAppAccountName`

The location of the backup policy. Required if the template is used in a standalone deployment.
The name of the parent NetApp account. Required if the template is used in a standalone deployment.

- Required: Yes
- Type: string
Expand All @@ -49,45 +44,61 @@ The location of the backup policy. Required if the template is used in a standal

The daily backups to keep.

- Required: Yes
- Type: int

### Parameter: `monthlyBackupsToKeep`

The monthly backups to keep.

- Required: Yes
- Required: No
- Type: int
- Default: `2`
- MinValue: 2
- MaxValue: 1019

### Parameter: `weeklyBackupsToKeep`
### Parameter: `enabled`

The weekly backups to keep.
Indicates whether the backup policy is enabled.

- Required: Yes
- Type: int
- Required: No
- Type: bool
- Default: `True`
- MinValue: 2
- MaxValue: 1019

### Parameter: `netAppAccountName`
### Parameter: `location`

The name of the parent NetApp account. Required if the template is used in a standalone deployment.
The location of the backup policy.

- Required: Yes
- Required: No
- Type: string
- Default: `[resourceGroup().location]`
- MinValue: 2
- MaxValue: 1019

### Parameter: `backupEnabled`
### Parameter: `monthlyBackupsToKeep`

Indicates whether the backup policy is enabled.
The monthly backups to keep.

- Required: No
- Type: bool
- Default: `False`
- Type: int
- Default: `0`
- MinValue: 2
- MaxValue: 1019

### Parameter: `backupPolicyName`
### Parameter: `name`

The name of the backup policy.

- Required: No
- Type: string
- Default: `'backupPolicy'`
- MinValue: 2
- MaxValue: 1019

### Parameter: `weeklyBackupsToKeep`

The weekly backups to keep.

- Required: No
- Type: int
- Default: `0`
- MinValue: 2
- MaxValue: 1019

## Outputs

Expand Down
30 changes: 16 additions & 14 deletions avm/res/net-app/net-app-account/backup-policies/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,38 @@ metadata description = 'This module deploys a Backup Policy for Azure NetApp Fil
param netAppAccountName string

@description('Optional. The name of the backup policy.')
param backupPolicyName string = 'backupPolicy'
param name string = 'backupPolicy'

@description('Required. The location of the backup policy. Required if the template is used in a standalone deployment.')
param backupPolicyLocation string
@description('Optional. The location of the backup policy.')
param location string = resourceGroup().location

@description('Required. The daily backups to keep.')
param dailyBackupsToKeep int
@description('Optional. The daily backups to keep.')
@minValue(2)
@maxValue(1019)
param dailyBackupsToKeep int = 2

@description('Required. The monthly backups to keep.')
param monthlyBackupsToKeep int
@description('Optional. The monthly backups to keep.')
param monthlyBackupsToKeep int = 0

@description('Required. The weekly backups to keep.')
param weeklyBackupsToKeep int
@description('Optional. The weekly backups to keep.')
param weeklyBackupsToKeep int = 0

@description('Optional. Indicates whether the backup policy is enabled.')
param backupEnabled bool = false
param enabled bool = true

resource netAppAccount 'Microsoft.NetApp/netAppAccounts@2024-03-01' existing = {
name: netAppAccountName
}

resource backupPolicies 'Microsoft.NetApp/netAppAccounts/backupPolicies@2024-03-01' = {
name: backupPolicyName
name: name
parent: netAppAccount
location: backupPolicyLocation
location: location
properties: {
enabled: enabled
dailyBackupsToKeep: dailyBackupsToKeep
enabled: backupEnabled
monthlyBackupsToKeep: monthlyBackupsToKeep
weeklyBackupsToKeep: weeklyBackupsToKeep
monthlyBackupsToKeep: monthlyBackupsToKeep
}
}
@description('The resource IDs of the backup Policy created within volume.')
Expand Down
40 changes: 23 additions & 17 deletions avm/res/net-app/net-app-account/backup-policies/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "2321320275404095362"
"version": "0.33.13.18514",
"templateHash": "1799863578493793686"
},
"name": "Azure NetApp Files Backup Policy",
"description": "This module deploys a Backup Policy for Azure NetApp File."
Expand All @@ -17,40 +17,46 @@
"description": "Conditional. The name of the parent NetApp account. Required if the template is used in a standalone deployment."
}
},
"backupPolicyName": {
"name": {
"type": "string",
"defaultValue": "backupPolicy",
"metadata": {
"description": "Optional. The name of the backup policy."
}
},
"backupPolicyLocation": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Required. The location of the backup policy. Required if the template is used in a standalone deployment."
"description": "Optional. The location of the backup policy."
}
},
"dailyBackupsToKeep": {
"type": "int",
"defaultValue": 2,
"minValue": 2,
"maxValue": 1019,
"metadata": {
"description": "Required. The daily backups to keep."
"description": "Optional. The daily backups to keep."
}
},
"monthlyBackupsToKeep": {
"type": "int",
"defaultValue": 0,
"metadata": {
"description": "Required. The monthly backups to keep."
"description": "Optional. The monthly backups to keep."
}
},
"weeklyBackupsToKeep": {
"type": "int",
"defaultValue": 0,
"metadata": {
"description": "Required. The weekly backups to keep."
"description": "Optional. The weekly backups to keep."
}
},
"backupEnabled": {
"enabled": {
"type": "bool",
"defaultValue": false,
"defaultValue": true,
"metadata": {
"description": "Optional. Indicates whether the backup policy is enabled."
}
Expand All @@ -60,13 +66,13 @@
{
"type": "Microsoft.NetApp/netAppAccounts/backupPolicies",
"apiVersion": "2024-03-01",
"name": "[format('{0}/{1}', parameters('netAppAccountName'), parameters('backupPolicyName'))]",
"location": "[parameters('backupPolicyLocation')]",
"name": "[format('{0}/{1}', parameters('netAppAccountName'), parameters('name'))]",
"location": "[parameters('location')]",
"properties": {
"enabled": "[parameters('enabled')]",
"dailyBackupsToKeep": "[parameters('dailyBackupsToKeep')]",
"enabled": "[parameters('backupEnabled')]",
"monthlyBackupsToKeep": "[parameters('monthlyBackupsToKeep')]",
"weeklyBackupsToKeep": "[parameters('weeklyBackupsToKeep')]"
"weeklyBackupsToKeep": "[parameters('weeklyBackupsToKeep')]",
"monthlyBackupsToKeep": "[parameters('monthlyBackupsToKeep')]"
}
}
],
Expand All @@ -76,14 +82,14 @@
"metadata": {
"description": "The resource IDs of the backup Policy created within volume."
},
"value": "[resourceId('Microsoft.NetApp/netAppAccounts/backupPolicies', parameters('netAppAccountName'), parameters('backupPolicyName'))]"
"value": "[resourceId('Microsoft.NetApp/netAppAccounts/backupPolicies', parameters('netAppAccountName'), parameters('name'))]"
},
"name": {
"type": "string",
"metadata": {
"description": "The name of the Backup Policy."
},
"value": "[parameters('backupPolicyName')]"
"value": "[parameters('name')]"
},
"resourceGroupName": {
"type": "string",
Expand Down
121 changes: 121 additions & 0 deletions avm/res/net-app/net-app-account/backup-vault/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Azure NetApp Files Volume Backup Vault `[Microsoft.NetApp/netAppAccounts/backupVaults]`

This module deploys a NetApp Files Backup Vault.

## Navigation

- [Resource Types](#Resource-Types)
- [Parameters](#Parameters)
- [Outputs](#Outputs)

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.NetApp/netAppAccounts/backupVaults` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/backupVaults) |
| `Microsoft.NetApp/netAppAccounts/backupVaults/backups` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/backupVaults/backups) |

## Parameters

**Conditional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`netAppAccountName`](#parameter-netappaccountname) | string | The name of the parent NetApp account. Required if the template is used in a standalone deployment. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`backups`](#parameter-backups) | array | The list of backups to create. |
| [`location`](#parameter-location) | string | Location of the backup vault. |
| [`name`](#parameter-name) | string | The name of the backup vault. |

### Parameter: `netAppAccountName`

The name of the parent NetApp account. Required if the template is used in a standalone deployment.

- Required: Yes
- Type: string

### Parameter: `backups`

The list of backups to create.

- Required: No
- Type: array

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`capacityPoolName`](#parameter-backupscapacitypoolname) | string | The name of the capacity pool containing the volume. |
| [`volumeName`](#parameter-backupsvolumename) | string | The name of the volume to backup. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`label`](#parameter-backupslabel) | string | Label for backup. |
| [`name`](#parameter-backupsname) | string | The name of the backup. |
| [`snapshotName`](#parameter-backupssnapshotname) | string | The name of the snapshot. |

### Parameter: `backups.capacityPoolName`

The name of the capacity pool containing the volume.

- Required: Yes
- Type: string

### Parameter: `backups.volumeName`

The name of the volume to backup.

- Required: Yes
- Type: string

### Parameter: `backups.label`

Label for backup.

- Required: No
- Type: string

### Parameter: `backups.name`

The name of the backup.

- Required: No
- Type: string

### Parameter: `backups.snapshotName`

The name of the snapshot.

- Required: No
- Type: string

### Parameter: `location`

Location of the backup vault.

- Required: No
- Type: string
- Default: `[resourceGroup().location]`

### Parameter: `name`

The name of the backup vault.

- Required: No
- Type: string
- Default: `'vault'`

## Outputs

| Output | Type | Description |
| :-- | :-- | :-- |
| `location` | string | The location the resource was deployed into. |
| `name` | string | The name of the backup vault. |
| `resourceGroupName` | string | The name of the Resource Group the backup vault was created in. |
| `resourceId` | string | The Resource ID of the backup vault. |
Loading

0 comments on commit 8ad13c9

Please sign in to comment.