Open RS-MPersson opened 3 months ago
Hello! A TemplateAnalyzer update is coming soon (hopefully next week). We hope that will provide a fix for this issue. Would you mind circling back a week from now if the issue is still occurring with the new version? Thanks!!
Describe the bug
When running Template analyzer
Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzerException: Error while evaluating rules. ---> Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzerException: Error while processing template. ---> Azure.Deployments.Templates.Exceptions.TemplateValidationException: The template resource 'item1/link-[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1' for type 'Microsoft.Network/privateDnsZones/virtualNetworkLinks' at line '1' and column '519' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-syntax-resources for usage details.
Expected behavior
Analyze of the code should go through without error.
Reproduction Steps
Running a module in main.bicep
module privateDnsZonesVnetLinks 'modules/virtualNetworkLinks.bicep' = { scope: privateDnsRg name: 'privDnsZonesVnetLinks-deploy' params: { privateDnsZones: privateDnsZones vnetDnsResolverId: privateDnsResolver.outputs.vnetId vnetDnsResolverName: privateDnsResolver.outputs.vnetName } }
Bicep template of the module
param privateDnsZones array param vnetDnsResolverId string param vnetDnsResolverName string
resource privDnsZones 'Microsoft.Network/privateDnsZones@2020-06-01' existing = [for privateDnsZoneName in privateDnsZones: { name: privateDnsZoneName }]
resource virtualNetworkLinks 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = [for (privateDnsZone, i) in privateDnsZones: { name: '${take('link-${vnetDnsResolverName}', 80)}' parent: privDnsZones[i] location: 'global' properties: { registrationEnabled: false virtualNetwork: { id: vnetDnsResolverId } } }]
Environment
0.7.0+582d9199d19acc60716af8f0874dc51cec6aa01b VS Code 1.86