bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Outputing a nested resource in a module results in deployment errors

Open jeskew opened this issue 2 years ago • 1 comments

Discussed in https://github.com/Azure/bicep/discussions/12890

Originally posted by jahead January 2, 2024 Hey another question #sorry. I know resourceTypedParamsAndOutputs is not GA but, I was just wondering if this is a bug | future planned work | out-scope
I currently have a module

image

standard-app-service does a bunch of things, but ends like this. output appService resource = appService - with is a resource appService 'Microsoft.Web/sites@2023-01-01'

I then use the output in another parent module. The deployment works fine but azure deployment reports an error when completing the intermediate module.

The template output 'appService' is not valid: The language expression property 'id' can't be evaluated.. (Code: DeploymentOutputEvaluationFailed, Target: appService)

TLDR: moduleA.outputs.appService -> moduleB.outputs.appservice -> output resource appService results in: The template output 'appService' is not valid: The language expression property 'id' can't be evaluated.. (Code: DeploymentOutputEvaluationFailed, Target: appService)

If this a bug then I'll happily report it, otherwise just looking for clarity if this a known limitation, so I can design around it?

jeskew avatar Jan 02 '24 23:01 jeskew

After looking into and finding #12895 maybe this just isn't possible yet and the linter isn't catching module.outputs. as an error?

jahead avatar Jan 03 '24 11:01 jahead