Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.22k stars 747 forks source link

Nested outputs no longer working #2730

Closed dkirrane closed 3 years ago

dkirrane commented 3 years ago

Bicep version Bicep v0.3.539

Describe the bug I have the following in bicep that previously worked. It now fails with Code:DeploymentOutputEvaluationFailed

resource hyperscale 'Microsoft.DBforPostgreSQL/serverGroupsv2@2020-10-05-privatepreview' = {
....
}

output coordinatorUri string = hyperscale.properties.serverRoleGroups[0].serverNames[0].fullyQualifiedDomainName

Error

15:12:46 - The deployment 'hyperscale' failed with error(s). Showing 1 out of 1 error(s). Status Message: The template output 'coordinatorUri' is not valid: The language expression property
     | 'serverRoleGroups' doesn't exist, available properties are 'enableMx, enableZfs, citusVersion, state, resourceProviderType'.. (Code:DeploymentOutputEvaluationFailed)

I can confirm when I just output output hyperscale object = hyperscale I can see that above expression should work

dkirrane commented 3 years ago

Could this be a result of an API issue. I'm seeing the following when I try read via powershell

$outputs = Get-AzResourceGroupDeployment -ResourceGroupName "my-hyperscale-rg" -Name "hyperscale"
$coordinatorUri = $outputs.Outputs["hyperscale"].value.properties.serverRoleGroups[0].serverNames[0].fullyQualifiedDomainName
Write-Host "coordinatorUri: $coordinatorUri"

error

OperationStopped: get-output2.ps
Line |
   3 |  Write-Host "coordinatorUri: $coordinatorUri"
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'System.String'.
alex-frankel commented 3 years ago

It looks like the postgres team may have removed this property in this apiVersion. @dkirrane - are you able to open a support case to figure out if that's what happened? They should not be shipping breaking changes to an existing API version