Unable to output entire resource object? #2663
-
when you output an entire resource the object seems to change. Was expecting this to work but it does not Bicep CLI version 0.3.255 (589f037) // network.bicep
resource vnet 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: 'default'
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/8'
]
}
}
output vnet object = vnet // vnl.bicep
param vnet object
resource vnl 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = {
name: 'vnl'
location: 'global'
parent: pdz
properties: {
virtualNetwork: {
id: vnet.id
}
registrationEnabled: true
}
} deployment Deployment failed. Correlation ID: -{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "BadRequest",
"message": "{\r\n \"error\": {\r\n \"code\": \"InvalidTemplate\",\r\n \"message\": \"Unable to process template language expressions for resource '/subscriptions/-/resourceGroups/jy-sap/providers/Microsoft.Network/privateDnsZones/privatelink.file.core.windows.net/virtualNetworkLinks/nfs' at line '1' and column '5908'. 'The language expression property 'id' doesn't exist, available properties are 'apiVersion, location, properties, subscriptionId, resourceGroupName, scope, resourceId, referenceApiVersion, condition, isConditionTrue, isTemplateResource, isAction, provisioningOperation'.'\",\r\n \"additionalInfo\": [\r\n {\r\n \"type\": \"TemplateViolation\",\r\n \"info\": {\r\n \"lineNumber\": 1,\r\n \"linePosition\": 5908,\r\n \"path\": \"\"\r\n }\r\n }\r\n ]\r\n }\r\n}"
}
]
}
]
}
} trying virtualNetwork: {
id: vnet.resourceId
} results in Deployment failed. Correlation ID: -. {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "BadRequest",
"message": "{\r\n \"error\": {\r\n \"code\": \"LinkedInvalidPropertyId\",\r\n \"message\": \"Property id 'Microsoft.Network/virtualNetworks/default' at path 'properties.virtualNetwork.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.\"\r\n }\r\n}"
}
]
}
]
} had to resort to outputting pieces of the vnet resource |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @jamesongithub, You would most likely be interested in this proposal.. Which covers what you are asking, as a new feature. allow a new parameter (or output) type of resource (allow constraining it to a specific resource type) and pass in a full resource object to reference it within a Module. Saves you having to use the existing lookup in the Module, just pass in the full resource via the params |
Beta Was this translation helpful? Give feedback.
Hi @jamesongithub,
You would most likely be interested in this proposal.. Which covers what you are asking, as a new feature.
#2246
allow a new parameter (or output) type of resource (allow constraining it to a specific resource type) and pass in a full resource object to reference it within a Module.
Saves you having to use the existing lookup in the Module, just pass in the full resource via the params