@@ -241,9 +241,11 @@ private static async Task<ApplicationResult> Estimate(FileInfo templateFile,
241241 }
242242
243243 var parameters = "{}" ;
244+ var isUsingBicepparamFile = false ;
244245 if ( options . ParametersFile != null )
245- {
246- var fileContent = options . ParametersFile . FullName . EndsWith ( ".bicepparam" ) ? new BicepCompiler ( logger ) . CompileBicepparam ( options . ParametersFile , _cancellationTokenSource . Token ) : File . ReadAllText ( options . ParametersFile . FullName ) ;
246+ {
247+ isUsingBicepparamFile = options . ParametersFile . FullName . EndsWith ( ".bicepparam" ) ;
248+ var fileContent = isUsingBicepparamFile ? new BicepCompiler ( logger ) . CompileBicepparam ( options . ParametersFile , _cancellationTokenSource . Token ) : File . ReadAllText ( options . ParametersFile . FullName ) ;
247249 if ( fileContent == null )
248250 {
249251 var error = $ "Couldn't read parameters file { options . ParametersFile . FullName } ";
@@ -260,7 +262,7 @@ private static async Task<ApplicationResult> Estimate(FileInfo templateFile,
260262 {
261263 try
262264 {
263- parser = new TemplateParser ( template , parameters , options . InlineParameters , scopeId , resourceGroupName , logger ) ;
265+ parser = new TemplateParser ( template , parameters , options . InlineParameters , scopeId , resourceGroupName , isUsingBicepparamFile , logger ) ;
264266 }
265267 catch ( JsonException ex )
266268 {
@@ -280,7 +282,7 @@ private static async Task<ApplicationResult> Estimate(FileInfo templateFile,
280282 }
281283 }
282284
283- var whatIfParser = new WhatIfParser ( templateType , scopeId , resourceGroupName , template , parameters , logger , commandType , location , options ) ;
285+ var whatIfParser = new WhatIfParser ( templateType , scopeId , resourceGroupName , template , parser . Parameters , logger , commandType , location , options ) ;
284286 var whatIfData = await whatIfParser . GetWhatIfData ( _cancellationTokenSource . Token ) ;
285287 if ( whatIfData == null )
286288 {
0 commit comments