Skip to content

Commit

Permalink
feat: additional parameters for anf (#3055)
Browse files Browse the repository at this point in the history
## Description
Additional parameters for - 

- snapshot policies
- backup policies
- backup vaults and backups
- encryptionKeySource - Microsot.KeyVault or Microsoft.NetApp
- Latest API's 2024-03-01 as per NetApp releases
- fix ternary statements

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

## Pipeline Reference

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

| Pipeline |
| -------- |

[![avm.res.net-app.net-app-account](https://github.com/bobmclane999/bicep-registry-modules/actions/workflows/avm.res.net-app.net-app-account.yml/badge.svg?branch=feat--additional-parameters-for-ANF)](https://github.com/bobmclane999/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`.
  - [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: Jack Tracey <[email protected]>
Co-authored-by: Erika Gressi <[email protected]>
Co-authored-by: Felipe Binotto <[email protected]>
  • Loading branch information
4 people authored Aug 21, 2024
1 parent 61f090e commit 9cef9b3
Show file tree
Hide file tree
Showing 12 changed files with 1,308 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"editorconfig.editorconfig",
"ms-vscode.powershell"
]
}
}
21 changes: 15 additions & 6 deletions avm/res/net-app/net-app-account/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ This module deploys an Azure NetApp File.
| :-- | :-- |
| `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.NetApp/netAppAccounts` | [2023-07-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-07-01/netAppAccounts) |
| `Microsoft.NetApp/netAppAccounts/backupPolicies` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-11-01/netAppAccounts/backupPolicies) |
| `Microsoft.NetApp/netAppAccounts/backupVaults` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-05-01-preview/netAppAccounts/backupVaults) |
| `Microsoft.NetApp/netAppAccounts/backupVaults/backups` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-05-01-preview/netAppAccounts/backupVaults/backups) |
| `Microsoft.NetApp/netAppAccounts/capacityPools` | [2023-07-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-07-01/netAppAccounts/capacityPools) |
| `Microsoft.NetApp/netAppAccounts/capacityPools/volumes` | [2023-07-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-07-01/netAppAccounts/capacityPools/volumes) |
| `Microsoft.NetApp/netAppAccounts` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts) |
| `Microsoft.NetApp/netAppAccounts/backupPolicies` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/backupPolicies) |
| `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) |
| `Microsoft.NetApp/netAppAccounts/capacityPools` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/capacityPools) |
| `Microsoft.NetApp/netAppAccounts/capacityPools/volumes` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/capacityPools/volumes) |
| `Microsoft.NetApp/netAppAccounts/snapshotPolicies` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/snapshotPolicies) |

## Usage examples

Expand Down Expand Up @@ -115,6 +116,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
size: 4398046511104
volumes: [
{
encryptionKeySource: '<encryptionKeySource>'
exportPolicyRules: [
{
allowedClients: '0.0.0.0/0'
Expand Down Expand Up @@ -144,6 +146,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
]
}
{
encryptionKeySource: '<encryptionKeySource>'
exportPolicyRules: [
{
allowedClients: '0.0.0.0/0'
Expand Down Expand Up @@ -251,6 +254,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
"size": 4398046511104,
"volumes": [
{
"encryptionKeySource": "<encryptionKeySource>",
"exportPolicyRules": [
{
"allowedClients": "0.0.0.0/0",
Expand Down Expand Up @@ -280,6 +284,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
]
},
{
"encryptionKeySource": "<encryptionKeySource>",
"exportPolicyRules": [
{
"allowedClients": "0.0.0.0/0",
Expand Down Expand Up @@ -397,6 +402,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
size: 4398046511104
volumes: [
{
encryptionKeySource: '<encryptionKeySource>'
exportPolicyRules: [
{
allowedClients: '0.0.0.0/0'
Expand Down Expand Up @@ -426,6 +432,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
]
}
{
encryptionKeySource: '<encryptionKeySource>'
name: 'nanaanfs3-vol-002'
networkFeatures: 'Standard'
protocolTypes: [
Expand Down Expand Up @@ -520,6 +527,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
"size": 4398046511104,
"volumes": [
{
"encryptionKeySource": "<encryptionKeySource>",
"exportPolicyRules": [
{
"allowedClients": "0.0.0.0/0",
Expand Down Expand Up @@ -549,6 +557,7 @@ module netAppAccount 'br/public:avm/res/net-app/net-app-account:<version>' = {
]
},
{
"encryptionKeySource": "<encryptionKeySource>",
"name": "nanaanfs3-vol-002",
"networkFeatures": "Standard",
"protocolTypes": [
Expand Down
11 changes: 6 additions & 5 deletions avm/res/net-app/net-app-account/capacity-pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ This module deploys an Azure NetApp Files Capacity Pool.
| 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.NetApp/netAppAccounts/backupPolicies` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-11-01/netAppAccounts/backupPolicies) |
| `Microsoft.NetApp/netAppAccounts/backupVaults` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-05-01-preview/netAppAccounts/backupVaults) |
| `Microsoft.NetApp/netAppAccounts/backupVaults/backups` | [2023-05-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-05-01-preview/netAppAccounts/backupVaults/backups) |
| `Microsoft.NetApp/netAppAccounts/capacityPools` | [2023-07-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-07-01/netAppAccounts/capacityPools) |
| `Microsoft.NetApp/netAppAccounts/capacityPools/volumes` | [2023-07-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2023-07-01/netAppAccounts/capacityPools/volumes) |
| `Microsoft.NetApp/netAppAccounts/backupPolicies` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/backupPolicies) |
| `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) |
| `Microsoft.NetApp/netAppAccounts/capacityPools` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/capacityPools) |
| `Microsoft.NetApp/netAppAccounts/capacityPools/volumes` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/capacityPools/volumes) |
| `Microsoft.NetApp/netAppAccounts/snapshotPolicies` | [2024-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.NetApp/2024-03-01/netAppAccounts/snapshotPolicies) |

## Parameters

Expand Down
78 changes: 50 additions & 28 deletions avm/res/net-app/net-app-account/capacity-pool/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ var formattedRoleAssignments = [
})
]

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

resource capacityPool 'Microsoft.NetApp/netAppAccounts/capacityPools@2023-07-01' = {
resource capacityPool 'Microsoft.NetApp/netAppAccounts/capacityPools@2024-03-01' = {
name: name
parent: netAppAccount
location: location
Expand All @@ -105,36 +105,58 @@ module capacityPool_volumes 'volume/main.bicep' = [
name: volume.name
location: location
serviceLevel: serviceLevel
creationToken: contains(volume, 'creationToken') ? volume.creationToken : volume.name
creationToken: volume.?creationToken ?? volume.name
usageThreshold: volume.usageThreshold
protocolTypes: contains(volume, 'protocolTypes') ? volume.protocolTypes : []
protocolTypes: volume.?protocolTypes ?? []
subnetResourceId: volume.subnetResourceId
exportPolicyRules: contains(volume, 'exportPolicyRules') ? volume.exportPolicyRules : []
roleAssignments: contains(volume, 'roleAssignments') ? volume.roleAssignments : []
exportPolicyRules: volume.?exportPolicyRules ?? []
roleAssignments: volume.?roleAssignments ?? []
networkFeatures: volume.?networkFeatures
zones: volume.?zones
coolAccess: contains(volume, 'coolAccess') ? volume.coolAccess : false
coolAccessRetrievalPolicy: contains(volume, 'coolAccessRetrievalPolicy')
? volume.coolAccessRetrievalPolicy
: 'Default'
coolnessPeriod: contains(volume, 'coolnessPeriod') ? volume.coolnessPeriod : 0
endpointType: contains(volume, 'endpointType') ? volume.endpointType : ''
remoteVolumeRegion: contains(volume, 'remoteVolumeRegion') ? volume.remoteVolumeRegion : ''
remoteVolumeResourceId: contains(volume, 'remoteVolumeResourceId') ? volume.remoteVolumeResourceId : ''
replicationSchedule: contains(volume, 'replicationSchedule') ? volume.replicationSchedule : ''
backupPolicyName: contains(volume, 'backupPolicyName') ? volume.backupPolicyName : 'backupPolicy'
backupPolicyLocation: contains(volume, 'backupPolicyLocation') ? volume.backupPolicyLocation : ''
dailyBackupsToKeep: contains(volume, 'dailyBackupsToKeep') ? volume.dailyBackupsToKeep : 0
backupEnabled: contains(volume, 'backupEnabled') ? volume.backupEnabled : false
monthlyBackupsToKeep: contains(volume, 'monthlyBackupsToKeep') ? volume.monthlyBackupsToKeep : 0
weeklyBackupsToKeep: contains(volume, 'weeklyBackupsToKeep') ? volume.weeklyBackupsToKeep : 0
backupVaultName: contains(volume, 'backupVaultName') ? volume.backupVaultName : 'vault'
backupVaultLocation: contains(volume, 'backupVaultLocation') ? volume.backupVaultLocation : ''
backupName: contains(volume, 'backupName') ? volume.backupName : 'backup'
backupLabel: contains(volume, 'backupLabel') ? volume.backupLabel : ''
snapshotName: contains(volume, 'snapshotName') ? volume.snapshotName : 'snapshot'
useExistingSnapshot: contains(volume, 'useExistingSnapshot') ? volume.useExistingSnapshot : false
volumeResourceId: contains(volume, 'volumeResourceId') ? volume.volumeResourceId : ''
coolAccess: volume.?coolAccess ?? false
coolAccessRetrievalPolicy: volume.?coolAccessRetrievalPolicy ?? 'Default'
coolnessPeriod: volume.?coolnessPeriod ?? 0
encryptionKeySource: volume.?encryptionKeySource ?? 'Microsoft.NetApp'
keyVaultPrivateEndpointResourceId: volume.?keyVaultPrivateEndpointResourceId ?? ''
endpointType: volume.?endpointType ?? ''
remoteVolumeRegion: volume.?remoteVolumeRegion ?? ''
remoteVolumeResourceId: volume.?remoteVolumeResourceId ?? ''
replicationSchedule: volume.?replicationSchedule ?? ''
snapshotPolicyId: volume.?snapshotPolicyId ?? ''
snapshotPolicyName: volume.?snapshotPolicyName ?? 'snapshotPolicy'
snapshotPolicyLocation: volume.?snapshotPolicyLocation ?? ''
snapEnabled: volume.?snapEnabled ?? false
dailyHour: volume.?dailyHour ?? 0
dailyMinute: volume.?dailyMinute ?? 0
dailySnapshotsToKeep: volume.?dailySnapshotsToKeep ?? 0
dailyUsedBytes: volume.?dailyUsedBytes ?? 0
hourlyMinute: volume.?hourlyMinute ?? 0
hourlySnapshotsToKeep: volume.?hourlySnapshotsToKeep ?? 0
hourlyUsedBytes: volume.?hourlyUsedBytes ?? 0
daysOfMonth: volume.?daysOfMonth ?? ''
monthlyHour: volume.?monthlyHour ?? 0
monthlyMinute: volume.?monthlyMinute ?? 0
monthlySnapshotsToKeep: volume.?monthlySnapshotsToKeep ?? 0
monthlyUsedBytes: volume.?monthlyUsedBytes ?? 0
weeklyDay: volume.?weeklyDay ?? ''
weeklyHour: volume.?weeklyHour ?? 0
weeklyMinute: volume.?weeklyMinute ?? 0
weeklySnapshotsToKeep: volume.?weeklySnapshotsToKeep ?? 0
weeklyUsedBytes: volume.?weeklyUsedBytes ?? 0
backupPolicyName: volume.?backupPolicyName ?? 'backupPolicy'
backupPolicyLocation: volume.?backupPolicyLocation ?? ''
dailyBackupsToKeep: volume.?dailyBackupsToKeep ?? 0
backupEnabled: volume.?backupEnabled ?? false
monthlyBackupsToKeep: volume.?monthlyBackupsToKeep ?? 0
weeklyBackupsToKeep: volume.?weeklyBackupsToKeep ?? 0
backupVaultName: volume.?backupVaultName ?? 'vault'
backupVaultLocation: volume.?backupVaultLocation ?? ''
backupName: volume.?backupName ?? 'backup'
backupLabel: volume.?backupLabel ?? ''
snapshotName: volume.?snapshotName ?? 'snapshot'
useExistingSnapshot: volume.?useExistingSnapshot ?? false
volumeResourceId: volume.?volumeResourceId ?? ''
volumeType: volume.?volumeType ?? ''
}
}
]
Expand Down
Loading

0 comments on commit 9cef9b3

Please sign in to comment.