Skip to content

[FEATURE/DISCUSSION] - How to deal with Azure Deployment Stacks outputs and PSRule #3105

@riosengineer

Description

@riosengineer

Hey Bernie.

I'm heavily using ADS now and with that, I am usually pulling in the existing resource stack to downstream templates to get their output values dynamically.

My issue with this for PSRule is we require all values present before the template can expand and run the ruleset.

I am wondering if there's any idea or neat way to get around this scenario as I see it becoming more popular over time. I don't really want to make my existing resource optional in my production template, and alternatives seem tedious and repetitive. (like copying my main template to my test file just to conditional / mock)

// hub stack reference
resource resHubStack 'Microsoft.Resources/deploymentStacks@2024-03-01' existing = {
  name: parHubStackName
  scope: subscription(parHubSubscriptionId)
}
...

module modVirtualNetwork 'br/public:avm/res/network/virtual-network:0.7.1' = {
  params: {
....
    peerings: [
      {
        remoteVirtualNetworkResourceId: resHubStack.properties.outputs.outHubVirtualNetworkId.value

My test file for PSRule doesn't have this value, so it fails.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions