Closed tstooke closed 1 year ago
@BernieWhite Just curious to know if there's any update on this one. Is it a bigger issue to fix than some of the others we've seen? This is preventing us from either using PSRule or from removing some hard-coded values from our Bicep files. Thanks!
@tstooke Runtime properties can introduce several complications that can be hard to work past.
Runtime properties are any property that you don't define in code but expect to be there, because they are automatically set by ARM.
We'll try to get this in for v1.31.x, which should land by mid next month.
I expected it would be a bit more complicated and possibly delicate, and we appreciate any extra effort needed to get it working. I'm curious to see how it gets implemented in the engine!
Description of the issue
Bicep expansion appears to be incomplete and throws errors when running PSRule tests against a module that exposes an object created by Azure as an output variable.
We have a Service Bus module that automatically creates the API Connection Resources for use by our Logic Apps. To avoid hard-coding names and references, we include some properties from the Connections'
properites.api
object as outputs for the module. PSRule seems to have trouble dealing with the multiple layers or it's not generating a placeholder for the Azure-based API properties or it's something completely different.To Reproduce
Use this
main.bicep
file:And this test file:
Expected behaviour
No compiler errors and all tests run and pass.
Error output
With the above sample files, we get this error:
When we have a similar setup in our real files, we get a different error message, but it appears to be related to the same spot.
NOTE: These errors have slightly different dot-notation chains because they come from two slightly different ways that we've exposed the API Connection properties. The ultimate issue, though, is that those API Connection properties don't seem to be available in the output when the Bicep file is compiled by PSRule. Perhaps those API Connection properties are only available at runtime when the ARM Deployment handles things?
Module in use and version:
Captured output from
$PSVersionTable
:Also Note: When we turn off the PSRule step in our CI/CD pipeline, the actual Bicep deployment does work. It seems to be just an issue with how PSRule is handling things.