-
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
Instance functions on resource typed params and outputs crash the build and are not proposed as completions #10994
Comments
Adding visual example/repro ...
Example1 - resourceTypedParamsAndOutputs - No Function?param ir resource 'Microsoft.DataFactory/factories/integrationRuntimes@2018-06-01'
output authkeys object = ir. Example2 - existing - Functionresource irexisting 'Microsoft.DataFactory/factories/integrationRuntimes@2018-06-01' existing = {
name: ir.name
}
output authkeysexisting object = irexisting. |
Other screenshot for example 1. After writing list*() manually intellisense displays correct types The crash with jikuja/azure-data-factory-runtime-aci@5d6b68a
|
jeskew
added a commit
that referenced
this issue
Jun 23, 2023
Resolves #10994 Although instance functions on resource-typed outputs and parameters currently raise no diagnostics, they are not proposed as completions and lead to an unhandled exception when the syntax is converted to the Bicep IR. This PR fixes up resource-typed params and outputs instance function support with three changes: * The IR conversion for `InstanceFunctionCallSyntax` is updated to support all resources, not just those of type `DeclaredResourceMetadata`. * A check is added to `EmitLimitationCalculator` to raise an error diagnostic when an instance function is called on a resource-typed module output, as `list*(reference(...).outputs. ...)` is blocked by ARM's dependency graph processor. (The `getSecret()` function doesn't result in nested runtime functions and so is permitted.) * The language server completion provider is updated to suggest known resource functions on resource-typed params and outputs. ###### Microsoft Reviewers: [Open in CodeFlow](https://portal.fabricbot.ms/api/codeflow?pullrequest=https://github.com/Azure/bicep/pull/11031)
Tested building PoC: https://github.com/jikuja/azure-data-factory-runtime-aci/tree/archive-resourceTypedParamsAndOutputs-1
All 🆗 Also deployed build results to Azure as extra testing. TYVM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in #10992
Originally posted by jikuja June 16, 2023
I just used resourceTypedParamsAndOutputs experimental feature to simplify our PoC template. Here is the diff of the relevant changes: jikuja/azure-data-factory-runtime-aci@security-1...jikuja:azure-data-factory-runtime-aci:bicep-resource-param-outputs
The only issue I encountered is the fact that
secureValue: ir.listAuthKeys().authKey1
is valid code according to intellisense but bicep build will crash. Changing that code tolistAuthKeys(ir.id, ir.apiVersion).authKey1
solved the issue.Feelings: This is a cool feature addition for Bicep. Passing resources instead of resource id and usage of existing key word is too verbose.
Alternative approach: jikuja/azure-data-factory-runtime-aci@security-1...jikuja:azure-data-factory-runtime-aci:id-plust-list-functions
Feelings: Usage pattern documentation of list*() methods without resource accessor is really limited. I should have noticed this approach earlier.
The text was updated successfully, but these errors were encountered: