Azure / Azure/arm-template-whatif

what-if for App Gateway does not preserve order of all child resources

Open
#387 5 comments 3 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
HTML
Stars
102
Forks
21
Avg merge
3h 35m
Merged PRs (30d)
1

Description

**Bicep version**
Bicep CLI version 0.32.4 (b326faa456)

This problem has also has happened on all earlier versions, I just haven't gotten around to a bug report until now.

**Describe the bug**
We have an Azure App Gateway we maintain via Bicep. Within it are the various child resources - backend pools, backend settings, request routing rules, probes, etc.

When running a what-if command, it does not maintain the order of child resources. I see this most often with the request routing rules, but have seen it with other child resources as well. The what-if will swap around some of the rules, so it looks like a ton of changes are being made when there are actually no changes. For example, if I have six routing rules, agwrr1 through agwrr6 (in that order), when I run a what-if, I might see:

```
~ properties.requestRoutingRules: [
~ 1:
~ name: "agwrr1" => "agwrr3"
~ propertyX: "propX1" => "propX3"
~ propertyY: "propY1" => "propY3"

~ 2:
~ name: "agwrr2" => "agwrr5"
~ propertyX: "propX2" => "propX5"
~ propertyY: "propY2" => "propY5"

~ 3:
~ name: "agwrr3" => "agwrr2"
~ propertyX: "propX3" => "propX2"
~ propertyY: "propY3" => "propY2"

~ 5:
~ name: "agwrr5" => "agwrr1"
~ propertyX: "propX5" => "propX1"
~ propertyY: "propY5" => "propY1"

```

...but with quite a few properties on each of these, with longer names and values, and no rhyme or reason I can find for why it puts them in that particular order. If I run the bicep file and then immediately do the what-if, I still get the same result, so I don't think that what-if here is predicting the changes accurately. When I execute the bicep file, it doesn't actually rearrange the rules.

This creates a lot of noise in the what-if, which makes it hard to see what actual changes are going to be applied, especially if there are changes in the request routing rules themselves (or whatever other child resource is getting incorrectly ordered).

**To Reproduce**
Create a bicep file for deploying an application gateway, set it up with several backend pools, backend settings, request routing rules, etc. Deploy it, then run a what-if.

I have searched for a report for this and didn't find one, though I know there are known issues with what-if.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with a Bicep application gateway containing several child resources, then deploy it and run what-if. Compare the reported ordering of request routing rules and other child resources with the deployed configuration; done means what-if no longer reports changes caused only by reordered resources.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.