Skip to content

Commit

Permalink
Added VNet Peering snippet (#2383)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIvemo authored May 3, 2021
1 parent 1e65823 commit 0841add
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Bicep.Core.Samples/Files/Completions/declarations.json
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,24 @@
"newText": "resource ${1:virtualNetwork} 'Microsoft.Network/virtualNetworks@2019-11-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n addressSpace: {\n addressPrefixes: [\n '10.0.0.0/16'\n ]\n }\n subnets: [\n {\n name: 'Subnet-1'\n properties: {\n addressPrefix: '10.0.0.0/24'\n }\n }\n {\n name: 'Subnet-2'\n properties: {\n addressPrefix: '10.0.1.0/24'\n }\n }\n ]\n }\n}\n"
}
},
{
"label": "res-vnet-peering",
"kind": "snippet",
"detail": "Virtual Network Peering",
"documentation": {
"kind": "markdown",
"value": "```bicep\nresource peering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-07-01' = {\n name: 'virtualNetwork/name'\n properties: {\n allowVirtualNetworkAccess: true\n allowForwardedTraffic: true\n allowGatewayTransit: true\n useRemoteGateways: true\n remoteVirtualNetwork: {\n id: resourceId('Microsoft.Network/virtualNetworks', 'REQUIRED')\n }\n }\n}\n\n```"
},
"deprecated": false,
"preselect": false,
"sortText": "2_res-vnet-peering",
"insertTextFormat": "snippet",
"insertTextMode": "adjustIndentation",
"textEdit": {
"range": {},
"newText": "resource ${1:peering} 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-07-01' = {\n name: ${2:'virtualNetwork/name'}\n properties: {\n allowVirtualNetworkAccess: ${3|true,false|}\n allowForwardedTraffic: ${4|true,false|}\n allowGatewayTransit: ${5|true,false|}\n useRemoteGateways: ${6|true,false|}\n remoteVirtualNetwork: {\n id: resourceId('Microsoft.Network/virtualNetworks', ${7:'REQUIRED'})\n }\n }\n}\n"
}
},
{
"label": "res-vpn-local-gateway",
"kind": "snippet",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// $1 = peering
// $2 = 'virtualNetwork/name'
// $3 = true
// $4 = true
// $5 = true
// $6 = true
// $7 = 'REQUIRED'

// Insert snippet here
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource peering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-07-01' = {
name: 'virtualNetwork/name'
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: true
allowGatewayTransit: true
useRemoteGateways: true
remoteVirtualNetwork: {
id: resourceId('Microsoft.Network/virtualNetworks', 'REQUIRED')
}
}
}

13 changes: 13 additions & 0 deletions src/Bicep.LangServer/Snippets/Templates/res-vnet-peering.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Virtual Network Peering
resource ${1:peering} 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-07-01' = {
name: ${2:'virtualNetwork/name'}
properties: {
allowVirtualNetworkAccess: ${3|true,false|}
allowForwardedTraffic: ${4|true,false|}
allowGatewayTransit: ${5|true,false|}
useRemoteGateways: ${6|true,false|}
remoteVirtualNetwork: {
id: resourceId('Microsoft.Network/virtualNetworks', ${7:'REQUIRED'})
}
}
}

0 comments on commit 0841add

Please sign in to comment.