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

cast strings #14

Merged
merged 13 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
92 changes: 35 additions & 57 deletions avm/res/network/network-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,46 +137,49 @@ module networkManager 'br/public:avm/res/network/network-manager:<version>' = {
appliesToGroups: [
{
groupConnectivity: 'None'
isGlobal: 'False'
isGlobal: false
networkGroupId: '<networkGroupId>'
useHubGateway: 'False'
useHubGateway: false
}
]
connectivityTopology: 'HubAndSpoke'
deleteExistingPeering: 'True'
deleteExistingPeering: true
description: 'hubSpokeConnectivity description'
hubs: [
{
resourceId: '<resourceId>'
resourceType: 'Microsoft.Network/virtualNetworks'
}
]
isGlobal: 'True'
isGlobal: false
name: 'hubSpokeConnectivity'
}
{
appliesToGroups: [
{
groupConnectivity: 'None'
isGlobal: 'False'
groupConnectivity: 'DirectlyConnected'
isGlobal: true
networkGroupId: '<networkGroupId>'
useHubGateway: 'False'
useHubGateway: false
}
]
connectivityTopology: 'Mesh'
deleteExistingPeering: 'True'
deleteExistingPeering: true
description: 'MeshConnectivity description'
isGlobal: 'True'
isGlobal: true
name: 'MeshConnectivity-1'
}
{
appliesToGroups: [
{
groupConnectivity: 'DirectlyConnected'
isGlobal: false
networkGroupId: '<networkGroupId>'
useHubGateway: false
}
]
connectivityTopology: 'Mesh'
isGlobal: false
name: 'MeshConnectivity-2'
}
]
Expand All @@ -188,7 +191,7 @@ module networkManager 'br/public:avm/res/network/network-manager:<version>' = {
networkGroups: [
{
description: 'network-group-spokes description'
name: 'network-group-spokes'
name: 'network-group-spokes-1'
staticMembers: [
{
name: 'virtualNetworkSpoke1'
Expand Down Expand Up @@ -389,46 +392,49 @@ module networkManager 'br/public:avm/res/network/network-manager:<version>' = {
"appliesToGroups": [
{
"groupConnectivity": "None",
"isGlobal": "False",
"isGlobal": false,
"networkGroupId": "<networkGroupId>",
"useHubGateway": "False"
"useHubGateway": false
}
],
"connectivityTopology": "HubAndSpoke",
"deleteExistingPeering": "True",
"deleteExistingPeering": true,
"description": "hubSpokeConnectivity description",
"hubs": [
{
"resourceId": "<resourceId>",
"resourceType": "Microsoft.Network/virtualNetworks"
}
],
"isGlobal": "True",
"isGlobal": false,
"name": "hubSpokeConnectivity"
},
{
"appliesToGroups": [
{
"groupConnectivity": "None",
"isGlobal": "False",
"groupConnectivity": "DirectlyConnected",
"isGlobal": true,
"networkGroupId": "<networkGroupId>",
"useHubGateway": "False"
"useHubGateway": false
}
],
"connectivityTopology": "Mesh",
"deleteExistingPeering": "True",
"deleteExistingPeering": true,
"description": "MeshConnectivity description",
"isGlobal": "True",
"isGlobal": true,
"name": "MeshConnectivity-1"
},
{
"appliesToGroups": [
{
"groupConnectivity": "DirectlyConnected",
"networkGroupId": "<networkGroupId>"
"isGlobal": false,
"networkGroupId": "<networkGroupId>",
"useHubGateway": false
}
],
"connectivityTopology": "Mesh",
"isGlobal": false,
"name": "MeshConnectivity-2"
}
]
Expand All @@ -446,7 +452,7 @@ module networkManager 'br/public:avm/res/network/network-manager:<version>' = {
"value": [
{
"description": "network-group-spokes description",
"name": "network-group-spokes",
"name": "network-group-spokes-1",
"staticMembers": [
{
"name": "virtualNetworkSpoke1",
Expand Down Expand Up @@ -864,10 +870,10 @@ Connectivity Configurations to create for the network manager. Network manager m

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`deleteExistingPeering`](#parameter-connectivityconfigurationsdeleteexistingpeering) | string | Delete existing peering connections. |
| [`deleteExistingPeering`](#parameter-connectivityconfigurationsdeleteexistingpeering) | bool | Delete existing peering connections. |
| [`description`](#parameter-connectivityconfigurationsdescription) | string | A description of the connectivity configuration. |
| [`hubs`](#parameter-connectivityconfigurationshubs) | array | The hubs to apply the configuration to. |
| [`isGlobal`](#parameter-connectivityconfigurationsisglobal) | string | Is global configuration. |
| [`isGlobal`](#parameter-connectivityconfigurationsisglobal) | bool | Is global configuration. |

### Parameter: `connectivityConfigurations.appliesToGroups`

Expand All @@ -887,8 +893,8 @@ Network Groups for the configuration. A connectivity configuration must be assoc

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`isGlobal`](#parameter-connectivityconfigurationsappliestogroupsisglobal) | string | Flag if global is supported. |
| [`useHubGateway`](#parameter-connectivityconfigurationsappliestogroupsusehubgateway) | string | Flag if use hub gateway. |
| [`isGlobal`](#parameter-connectivityconfigurationsappliestogroupsisglobal) | bool | Flag if global is supported. |
| [`useHubGateway`](#parameter-connectivityconfigurationsappliestogroupsusehubgateway) | bool | Flag if use hub gateway. |

### Parameter: `connectivityConfigurations.appliesToGroups.groupConnectivity`

Expand Down Expand Up @@ -916,28 +922,14 @@ Network group Id.
Flag if global is supported.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `connectivityConfigurations.appliesToGroups.useHubGateway`

Flag if use hub gateway.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `connectivityConfigurations.connectivityTopology`

Expand Down Expand Up @@ -965,14 +957,7 @@ The name of the connectivity configuration.
Delete existing peering connections.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `connectivityConfigurations.description`

Expand Down Expand Up @@ -1020,14 +1005,7 @@ Resource type of the hub.
Is global configuration.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `description`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Connectivity configurations define hub-and-spoke or mesh topologies applied to o

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`deleteExistingPeering`](#parameter-deleteexistingpeering) | string | Flag if need to remove current existing peerings. If set to "True", all peerings on virtual networks in selected network groups will be removed and replaced with the peerings defined by this configuration. Optional when connectivityTopology is of type "HubAndSpoke". |
| [`deleteExistingPeering`](#parameter-deleteexistingpeering) | bool | Flag if need to remove current existing peerings. If set to "True", all peerings on virtual networks in selected network groups will be removed and replaced with the peerings defined by this configuration. Optional when connectivityTopology is of type "HubAndSpoke". |
| [`description`](#parameter-description) | string | A description of the connectivity configuration. |
| [`isGlobal`](#parameter-isglobal) | string | Flag if global mesh is supported. By default, mesh connectivity is applied to virtual networks within the same region. If set to "True", a global mesh enables connectivity across regions. |
| [`isGlobal`](#parameter-isglobal) | bool | Flag if global mesh is supported. By default, mesh connectivity is applied to virtual networks within the same region. If set to "True", a global mesh enables connectivity across regions. |

### Parameter: `appliesToGroups`

Expand All @@ -60,8 +60,8 @@ Network Groups for the configuration. A connectivity configuration must be assoc

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`isGlobal`](#parameter-appliestogroupsisglobal) | string | Flag if global is supported. |
| [`useHubGateway`](#parameter-appliestogroupsusehubgateway) | string | Flag if use hub gateway. |
| [`isGlobal`](#parameter-appliestogroupsisglobal) | bool | Flag if global is supported. |
| [`useHubGateway`](#parameter-appliestogroupsusehubgateway) | bool | Flag if use hub gateway. |

### Parameter: `appliesToGroups.groupConnectivity`

Expand Down Expand Up @@ -89,28 +89,14 @@ Network group Id.
Flag if global is supported.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `appliesToGroups.useHubGateway`

Flag if use hub gateway.

- Required: No
- Type: string
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool

### Parameter: `connectivityTopology`

Expand Down Expand Up @@ -179,15 +165,8 @@ The name of the parent network manager. Required if the template is used in a st
Flag if need to remove current existing peerings. If set to "True", all peerings on virtual networks in selected network groups will be removed and replaced with the peerings defined by this configuration. Optional when connectivityTopology is of type "HubAndSpoke".

- Required: No
- Type: string
- Default: `'False'`
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool
- Default: `False`

### Parameter: `description`

Expand All @@ -201,15 +180,8 @@ A description of the connectivity configuration.
Flag if global mesh is supported. By default, mesh connectivity is applied to virtual networks within the same region. If set to "True", a global mesh enables connectivity across regions.

- Required: No
- Type: string
- Default: `'False'`
- Allowed:
```Bicep
[
'False'
'True'
]
```
- Type: bool
- Default: `False`


## Outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ param connectivityTopology string
@sys.description('Conditional. List of hub items. This will create peerings between the specified hub and the virtual networks in the network group specified. Required if connectivityTopology is of type "HubAndSpoke".')
param hubs hubsType

@allowed([
'True'
'False'
])
@sys.description('Optional. Flag if need to remove current existing peerings. If set to "True", all peerings on virtual networks in selected network groups will be removed and replaced with the peerings defined by this configuration. Optional when connectivityTopology is of type "HubAndSpoke".')
param deleteExistingPeering string = 'False'
param deleteExistingPeering bool = false

@allowed([
'True'
'False'
])
@sys.description('Optional. Flag if global mesh is supported. By default, mesh connectivity is applied to virtual networks within the same region. If set to "True", a global mesh enables connectivity across regions.')
param isGlobal string = 'False'
param isGlobal bool = false

resource networkManager 'Microsoft.Network/networkManagers@2023-04-01' existing = {
name: networkManagerName
Expand All @@ -49,12 +41,20 @@ resource connectivityConfiguration 'Microsoft.Network/networkManagers/connectivi
name: name
parent: networkManager
properties: {
appliesToGroups: appliesToGroups
appliesToGroups: map(
appliesToGroups,
(group) => {
groupConnectivity: group.groupConnectivity
isGlobal: string(group.isGlobal) ?? 'false'
networkGroupId: any(group.networkGroupId)
useHubGateway: string(group.useHubGateway) ?? 'false'
}
)
connectivityTopology: connectivityTopology
deleteExistingPeering: connectivityTopology == 'HubAndSpoke' ? deleteExistingPeering : 'False'
deleteExistingPeering: connectivityTopology == 'HubAndSpoke' ? string(deleteExistingPeering) : 'false'
description: description ?? ''
hubs: connectivityTopology == 'HubAndSpoke' ? hubs : []
isGlobal: isGlobal
isGlobal: string(isGlobal)
}
}

Expand All @@ -76,13 +76,13 @@ type appliesToGroupsType = {
groupConnectivity: ('DirectlyConnected' | 'None')

@sys.description('Optional. Flag if global is supported.')
isGlobal: ('True' | 'False')?
isGlobal: bool?

@sys.description('Required. Network group Id.')
networkGroupId: string

@sys.description('Optional. Flag if use hub gateway.')
useHubGateway: ('True' | 'False')?
useHubGateway: bool?
}[]

type hubsType = {
Expand Down