Azure / Azure/bicep

Using a conditional in a module or resource scope produces error

Open
#1,876 10 comments 11 reactions 1 assignee Claimed by @anthony-c-martin View on GitHub
1.0 - Consider bug intermediate language revisit story: scopes
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

Adding one case that I think it's related with this - using a conditional in a module scope:

Following code:
```
module mod 'mod.bicep' = if (!empty(otherResourceGroup)) {
name: '${_deployment}-mod'
scope: !empty(otherResourceGroup) ? resourceGroup(otherResourceGroup) : resourceGroup()
```
results in error:
```
The property "scope" expected a value of type "resourceGroup" but the provided value is of type "resourceGroup | resourceGroup".
```

_Originally posted by @miqm in https://github.com/Azure/bicep/issues/449#issuecomment-799277431_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.