-
Notifications
You must be signed in to change notification settings - Fork 730
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
When using an imported user-defined functions that calls other udf and uses ternary ifs, deployment fails #12542
Comments
Thanks for reporting! This should be addressed in the next release. |
harshpatel17
pushed a commit
that referenced
this issue
Nov 28, 2023
Resolves #12542 The logic that replaces references in imported types, variables, and functions is not currently handling UDF calls within UDF calls, e.g., ```bicep func foo(input string) => input @export() func bar(input string) => foo(foo(input)) ``` In the definition of `bar`, the outer `foo` would be migrated (i.e., it would refer to a UDF in a closure namespace (`_1.foo`)), but the inner `foo` would not (i.e., it would refer to a UDF in the `__bicep` namespace). ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/12575)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bicep version
Bicep CLI version 0.23.1 (b02de2d)
Describe the bug
When using imported user-defined functions calling other functions that are not explicitly imported in the
import
statement. It seems that the deployment can fail if the nested functions are being used inside a ternary if and that they are not importedTo Reproduce
main.bicep
types.bicep
When attempting a deployment with the provided main.bicep, the deployment fails with the error:
if you modify the import statement to import all functions that are used by
getSubnetNumber
andisWindows
, attempting to deploy the template will then succeed.Both templates compile with the build command but only the last works in a deployment.
Additional context
The reason I believe the issue is linked to the ternary if is because I do not get the issue when nesting functions directly
Example:
In this situation, calling
a(input)
does not cause any issues.The text was updated successfully, but these errors were encountered: