Skip to content
110 changes: 37 additions & 73 deletions avm/res/network/nat-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
name: 'natGatewayDeployment'
params: {
// Required parameters
availabilityZone: 1
name: 'nngmin001'
zone: 1
// Non-required parameters
location: '<location>'
}
}
```
Expand All @@ -71,15 +69,11 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"name": {
"value": "nngmin001"
},
"zone": {
"availabilityZone": {
"value": 1
},
// Non-required parameters
"location": {
"value": "<location>"
"name": {
"value": "nngmin001"
}
}
}
Expand All @@ -96,10 +90,8 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
using 'br/public:avm/res/network/nat-gateway:<version>'

// Required parameters
param availabilityZone = 1
param name = 'nngmin001'
param zone = 1
// Non-required parameters
param location = '<location>'
```

</details>
Expand All @@ -119,10 +111,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
name: 'natGatewayDeployment'
params: {
// Required parameters
availabilityZone: -1
name: 'nngepip001'
zone: 1
// Non-required parameters
location: '<location>'
publicIpResourceIds: '<publicIpResourceIds>'
}
}
Expand All @@ -141,16 +132,13 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"availabilityZone": {
"value": -1
},
"name": {
"value": "nngepip001"
},
"zone": {
"value": 1
},
// Non-required parameters
"location": {
"value": "<location>"
},
"publicIpResourceIds": {
"value": "<publicIpResourceIds>"
}
Expand All @@ -169,10 +157,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
using 'br/public:avm/res/network/nat-gateway:<version>'

// Required parameters
param availabilityZone = -1
param name = 'nngepip001'
param zone = 1
// Non-required parameters
param location = '<location>'
param publicIpResourceIds = '<publicIpResourceIds>'
```

Expand All @@ -193,8 +180,8 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
name: 'natGatewayDeployment'
params: {
// Required parameters
availabilityZone: 1
name: 'nngmax001'
zone: 1
// Non-required parameters
location: '<location>'
lock: {
Expand Down Expand Up @@ -284,12 +271,12 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"availabilityZone": {
"value": 1
},
"name": {
"value": "nngmax001"
},
"zone": {
"value": 1
},
// Non-required parameters
"location": {
"value": "<location>"
Expand Down Expand Up @@ -387,8 +374,8 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
using 'br/public:avm/res/network/nat-gateway:<version>'

// Required parameters
param availabilityZone = 1
param name = 'nngmax001'
param zone = 1
// Non-required parameters
param location = '<location>'
param lock = {
Expand Down Expand Up @@ -480,10 +467,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
name: 'natGatewayDeployment'
params: {
// Required parameters
availabilityZone: -1
name: 'nngcprx001'
zone: 0
// Non-required parameters
location: '<location>'
publicIPPrefixObjects: [
{
name: 'nngcprx001-pippre'
Expand All @@ -510,16 +496,13 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"availabilityZone": {
"value": -1
},
"name": {
"value": "nngcprx001"
},
"zone": {
"value": 0
},
// Non-required parameters
"location": {
"value": "<location>"
},
"publicIPPrefixObjects": {
"value": [
{
Expand All @@ -546,10 +529,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
using 'br/public:avm/res/network/nat-gateway:<version>'

// Required parameters
param availabilityZone = -1
param name = 'nngcprx001'
param zone = 0
// Non-required parameters
param location = '<location>'
param publicIPPrefixObjects = [
{
name: 'nngcprx001-pippre'
Expand Down Expand Up @@ -578,14 +560,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
name: 'natGatewayDeployment'
params: {
// Required parameters
availabilityZone: 1
name: 'nngwaf001'
zone: 1
// Non-required parameters
location: '<location>'
lock: {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
publicIPAddressObjects: [
{
diagnosticSettings: [
Expand Down Expand Up @@ -633,22 +610,13 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"availabilityZone": {
"value": 1
},
"name": {
"value": "nngwaf001"
},
"zone": {
"value": 1
},
// Non-required parameters
"location": {
"value": "<location>"
},
"lock": {
"value": {
"kind": "CanNotDelete",
"name": "myCustomLockName"
}
},
"publicIPAddressObjects": {
"value": [
{
Expand Down Expand Up @@ -698,14 +666,9 @@ module natGateway 'br/public:avm/res/network/nat-gateway:<version>' = {
using 'br/public:avm/res/network/nat-gateway:<version>'

// Required parameters
param availabilityZone = 1
param name = 'nngwaf001'
param zone = 1
// Non-required parameters
param location = '<location>'
param lock = {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
param publicIPAddressObjects = [
{
diagnosticSettings: [
Expand Down Expand Up @@ -747,8 +710,8 @@ param tags = {

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`availabilityZone`](#parameter-availabilityzone) | int | If set to 1, 2 or 3, the availability zone is hardcoded to that value. If set to -1, no zone is defined. Note that the availability zone number here are the logical availability zone in your Azure subscription. Different subscriptions might have a different mapping of the physical zone and logical zone. To understand more, please refer to [Physical and logical availability zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-overview?tabs=azure-cli#physical-and-logical-availability-zones). |
| [`name`](#parameter-name) | string | Name of the Azure Bastion resource. |
| [`zone`](#parameter-zone) | int | A list of availability zones denoting the zone in which Nat Gateway should be deployed. |

**Optional parameters**

Expand All @@ -765,29 +728,29 @@ param tags = {
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. |
| [`tags`](#parameter-tags) | object | Tags for the resource. |

### Parameter: `name`
### Parameter: `availabilityZone`

Name of the Azure Bastion resource.

- Required: Yes
- Type: string

### Parameter: `zone`

A list of availability zones denoting the zone in which Nat Gateway should be deployed.
If set to 1, 2 or 3, the availability zone is hardcoded to that value. If set to -1, no zone is defined. Note that the availability zone number here are the logical availability zone in your Azure subscription. Different subscriptions might have a different mapping of the physical zone and logical zone. To understand more, please refer to [Physical and logical availability zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-overview?tabs=azure-cli#physical-and-logical-availability-zones).

- Required: Yes
- Type: int
- Allowed:
```Bicep
[
0
-1
1
2
3
]
```

### Parameter: `name`

Name of the Azure Bastion resource.

- Required: Yes
- Type: string

### Parameter: `enableTelemetry`

Enable/Disable usage telemetry for module.
Expand Down Expand Up @@ -1006,6 +969,7 @@ This section gives you an overview of all local-referenced module files (i.e., o
| :-- | :-- |
| `br/public:avm/res/network/public-ip-address:0.5.1` | Remote reference |
| `br/public:avm/res/network/public-ip-prefix:0.4.1` | Remote reference |
| `br/public:avm/utl/types/avm-common-types:0.5.1` | Remote reference |

## Data Collection

Expand Down
54 changes: 9 additions & 45 deletions avm/res/network/nat-gateway/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ metadata description = 'This module deploys a NAT Gateway.'
@description('Required. Name of the Azure Bastion resource.')
param name string

@description('Required. A list of availability zones denoting the zone in which Nat Gateway should be deployed.')
@description('Required. If set to 1, 2 or 3, the availability zone is hardcoded to that value. If set to -1, no zone is defined. Note that the availability zone number here are the logical availability zone in your Azure subscription. Different subscriptions might have a different mapping of the physical zone and logical zone. To understand more, please refer to [Physical and logical availability zones](https://learn.microsoft.com/en-us/azure/reliability/availability-zones-overview?tabs=azure-cli#physical-and-logical-availability-zones).')
@allowed([
0
-1
1
2
3
])
param zone int
param availabilityZone int

@description('Optional. The idle timeout of the NAT gateway.')
param idleTimeoutInMinutes int = 5
Expand All @@ -31,11 +31,13 @@ param publicIPPrefixObjects array?
@description('Optional. Location for all resources.')
param location string = resourceGroup().location

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?

import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?

@description('Optional. Tags for the resource.')
param tags object?
Expand Down Expand Up @@ -111,7 +113,7 @@ module publicIPAddresses 'br/public:avm/res/network/public-ip-address:0.5.1' = [
skuName: 'Standard' // Must be standard
skuTier: publicIPAddressObject.?skuTier
tags: publicIPAddressObject.?tags ?? tags
zones: publicIPAddressObject.?zones ?? (zone != 0 ? [zone] : null)
zones: publicIPAddressObject.?zones ?? (availabilityZone != -1 ? [availabilityZone] : null)
enableTelemetry: enableReferencedModulesTelemetry
ddosSettings: publicIPAddressObject.?ddosSettings
dnsSettings: publicIPAddressObject.?dnsSettings
Expand Down Expand Up @@ -169,7 +171,7 @@ resource natGateway 'Microsoft.Network/natGateways@2023-04-01' = {
publicIpPrefixes: formattedPublicIpPrefixResourceIds.outputs.formattedResourceIds
publicIpAddresses: formattedPublicIpResourceIds.outputs.formattedResourceIds
}
zones: zone != 0 ? [string(zone)] : null
zones: availabilityZone != -1 ? [string(availabilityZone)] : null
}

resource natGateway_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
Expand Down Expand Up @@ -210,41 +212,3 @@ output resourceGroupName string = resourceGroup().name

@description('The location the resource was deployed into.')
output location string = natGateway.location

// =============== //
// Definitions //
// =============== //

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?
Loading