Describe the bug
I am using a module to name resources consistently. In one of the templates that use this module, properties for those resources are used as parameter values to nested modules. This works without issue for new resources.
When referencing an existing module and attempting to perform the same operation, the Bicep builds but ARM deployment fails. The error is:
Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'application-slot' at line '1466' and column '9' is not valid: The template function 'reference' is not expected at this location. Please see https://aka.ms/arm-template-expressions for usage details.
To Reproduce
Below is a snippet of the template that reproduces the issue.
Additional context
The workaround is to supply the names for existing resources as parameters. However this is not desirable as this template is the top level, so the resource-names.bicep module cannot be used to do this.
Expected behaviour is that this functionality either works, or that the bicep build blocks template generation with a helpful error.
Bicep version v0.11.1
Describe the bug I am using a module to name resources consistently. In one of the templates that use this module, properties for those resources are used as parameter values to nested modules. This works without issue for new resources.
When referencing an existing module and attempting to perform the same operation, the Bicep builds but ARM deployment fails. The error is:
Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'application-slot' at line '1466' and column '9' is not valid: The template function 'reference' is not expected at this location. Please see https://aka.ms/arm-template-expressions for usage details.
To Reproduce Below is a snippet of the template that reproduces the issue.
The ARM parameter generated is:
Additional context The workaround is to supply the names for existing resources as parameters. However this is not desirable as this template is the top level, so the
resource-names.bicep
module cannot be used to do this.Expected behaviour is that this functionality either works, or that the bicep build blocks template generation with a helpful error.