Skip to content

Bicep "concat()" doesn't play nicely with "what-if" #26223

Description

@rickbatka

Describe the bug

We use Bicep to deploy Azure Container Apps. We have a lot of apps, so we concatenate a base list of environment variables to each app, which then adds its own on top of that like this:

env: concat(myContainerApp.additionalEnvVars, [
            {
              name: 'MY_ENV_VAR'
              value:  'myValue'
            }
            // snip...
]

When I run az deployment group what-if to review the changes that will happen, even if nothing is actually changing at all, the entire environment variable section of the config is listed as a change every time.

The output of what-if looks like this:

 ~ properties.template.containers: [
      ~ 0:

        ~ env: [
           // ... all of my environment variables, as if I'm deleting them all (which I'm not)
// ...
] => "[concat(variables('myContainerApps')[copyIndex()].additionalEnvVars, createArray(createObject('name', 'MY_ENV_VAR', 'value', //...unreadable concatenated block of text that shows some kind of intermediate scripting language instead of just showing the resultant array

To Reproduce:

Run az deployment group what-if with any bicep file that uses concatenation

Expected Behavior

I expect the "before" and "after" results from the what-if command to show me the computed values, not some kind of intermediate scripting language. It's impossible to know if one of my container apps has a change in its environment variables, because all my apps show this mess in the what-if output.

Environment Summary

Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31, Ubuntu 20.04.3 LTS
Python 3.10.5
Installer: DEB

azure-cli 2.38.0 *

Extensions:
containerapp 0.3.7
storage-preview 0.8.3

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Metadata

Metadata

Assignees

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupAuto-AssignAuto assign by botAuto-ResolveAuto resolve by botService AttentionThis issue is responsible by Azure service team.act-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions