Azure / Azure/arm-template-whatif
what-if reporting modify to VNet
- Dominant language
- HTML
- Stars
- 101
- Forks
- 21
- Avg merge
- 3h 35m
- Merged PRs (30d)
- 1
Description
I created a VNet using:
_resource vnet 'Microsoft.Network/virtualNetworks@2020-08-01'_
And I created couple of Subnets in this VNet using:
_resource subnet 'Microsoft.Network/virtualNetworks/subnets@2021-02-01'_
I deployed the bicep template, it sucessfully created VNet and SubNets.
I then manually created a peering between the VNet and the Hub VNet.
**I ran what-if on the same template and I was expecting it to report "No" changes but it reported "1 to modify"**
Output from what-if:
`{
"after": {
"apiVersion": "2020-08-01",
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/virtualNetworks/vnetA",
"location": "australiaeast",
"name": "vnetA",
"properties": {
"addressSpace": {
"addressPrefixes": [
"x.x.x.x/x"
]
},
"enableDdosProtection": false
},
"resourceGroup": "rgA",
"type": "Microsoft.Network/virtualNetworks"
},
"before": {
"apiVersion": "2020-08-01",
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/virtualNetworks/vnetA",
"location": "australiaeast",
"name": "vnetA",
"properties": {
"addressSpace": {
"addressPrefixes": [
"x.x.x.x/x"
]
},
"enableDdosProtection": false,
"subnets": [
{
"name": "snetA",
"properties": {
"addressPrefix": "x.x.x.x/x",
"networkSecurityGroup": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/networkSecurityGroups/nsgA",
"resourceGroup": "rgA"
},
"privateEndpointNetworkPolicies": "Enabled",
"privateLinkServiceNetworkPolicies": "Enabled",
"routeTable": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/routeTables/rtA",
"resourceGroup": "rgA"
}
}
},
{
"name": "snetB",
"properties": {
"addressPrefix": "x.x.x.x/x",
"networkSecurityGroup": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/networkSecurityGroups/nsgA",
"resourceGroup": "rgA"
},
"privateEndpointNetworkPolicies": "Enabled",
"privateLinkServiceNetworkPolicies": "Enabled",
"routeTable": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/routeTables/rtA",
"resourceGroup": "rgA"
}
}
}
],
"virtualNetworkPeerings": [
{
"name": "vnetA_to_vnetHub",
"properties": {
"allowForwardedTraffic": true,
"allowGatewayTransit": false,
"allowVirtualNetworkAccess": true,
"doNotVerifyRemoteGateways": false,
"remoteAddressSpace": {
"addressPrefixes": [
"x.x.x.x/x"
]
},
"remoteVirtualNetwork": {
"id": "/subscriptions/subB/resourceGroups/rgB/providers/Microsoft.Network/virtualNetworks/vnetHub",
"resourceGroup": "rgB"
},
"useRemoteGateways": false
}
}
]
},
"resourceGroup": "rgA",
"type": "Microsoft.Network/virtualNetworks"
},
"changeType": "Modify",
"delta": [
{
"after": null,
"before": [
{
"name": "snetA",
"properties": {
"addressPrefix": "x.x.x.x/x",
"networkSecurityGroup": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/networkSecurityGroups/nsgA",
"resourceGroup": "rgA"
},
"privateEndpointNetworkPolicies": "Enabled",
"privateLinkServiceNetworkPolicies": "Enabled",
"routeTable": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/routeTables/rtA",
"resourceGroup": "rgA"
}
}
},
{
"name": "snetB",
"properties": {
"addressPrefix": "x.x.x.x/x",
"networkSecurityGroup": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/networkSecurityGroups/nsgA",
"resourceGroup": "rgA"
},
"privateEndpointNetworkPolicies": "Enabled",
"privateLinkServiceNetworkPolicies": "Enabled",
"routeTable": {
"id": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/routeTables/rtA",
"resourceGroup": "rgA"
}
}
}
],
"children": null,
"path": "properties.subnets",
"propertyChangeType": "Delete"
},
{
"after": null,
"before": [
{
"name": "vnetA_to_vnetHub",
"properties": {
"allowForwardedTraffic": true,
"allowGatewayTransit": false,
"allowVirtualNetworkAccess": true,
"doNotVerifyRemoteGateways": false,
"remoteAddressSpace": {
"addressPrefixes": [
"x.x.x.x/x"
]
},
"remoteVirtualNetwork": {
"id": "/subscriptions/subB/resourceGroups/rgB/providers/Microsoft.Network/virtualNetworks/vnetHub",
"resourceGroup": "rgB"
},
"useRemoteGateways": false
}
}
],
"children": null,
"path": "properties.virtualNetworkPeerings",
"propertyChangeType": "Delete"
}
],
"resourceId": "/subscriptions/subA/resourceGroups/rgA/providers/Microsoft.Network/virtualNetworks/vnetA"
}`
I ignored the what-if report and went ahead to deploy the template to check if it actually deletes the subnets and vnet peering and it didn't delete them which is what I was expecting.
Contributor guide
No contributing guide indexed for this repository
Research direction
No repository files or tests are named. Start by reproducing the described deployment and what-if run with the VNet, subnets, and manually created peering; done means what-if no longer reports those existing resources for deletion while deployment preserves them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100