-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a conditional in a module or resource scope produces error #1876
Comments
@anthony-c-martin - there's an even bigger bug with this - when I use any() in the scope, it doesn't produce the scope json code - it just ignores it without any warning. |
Something similar happens with |
Yeah, we started off with the premise that |
The For the issue originally reported here, I think we need a mechanism to simplify redundant union types in the type system. For this specific issue, removing duplicate types should be sufficient. But there are other cases. For example, |
In addition, we're not handling union types correctly when type checking the value of the |
I looked into this and this is not as simple as just fixing the type checks. To emit the JSON correctly, we need the following:
Number 1 prevents us from ever supporting free-form scope expressions like Another option that occurs to me is to support a scope expression like |
Because this is not a straightforward fix, we'd recommend using a ternary expression inside the resourceGroup() function like so: scope: resourceGroup(!empty(otherResourceGroup) ? otherResourceGroup : resourceGroup().name) We'll revisit this once we support the |
@alex-frankel and I also discussed an alternative to special case expressions like |
Adding one case that I think it's related with this - using a conditional in a module scope:
Following code:
results in error:
Originally posted by @miqm in #449 (comment)
The text was updated successfully, but these errors were encountered: