Skip to content

Property values originating from resource properties are not validated correctly #3215

@majastrz

Description

@majastrz

Bicep version
Latest in main.

Describe the bug
Type checking of property values when the property expects an object type by specifying a reference to a property of another resource does not work correctly.

To Reproduce
Steps to reproduce the behavior (comments indicates the bug):

resource bp 'Microsoft.Blueprint/blueprintAssignments@2018-11-01-preview' = {
  name: 't'
  location: resourceGroup().location
  identity: {
    type: 'None'
  }
  properties: {
    parameters: {
      'foo': {
        reference: {
          keyVault: {
            id: 's'
          }
          secretName: 's'
        }
      }
    }
    resourceGroups: {
      'bar': {
        name: 's'
        location: 's'
      }
    }
  }
}

resource bp2 'Microsoft.Blueprint/blueprintAssignments@2018-11-01-preview' = {
  name: 't2'
  location: resourceGroup().location
  identity: {
    type: 'None'
  }
  properties: {
    // BUG: the type of RG does not match the property type - independent of "additionalProperties"
    locks: bp.properties.resourceGroups.bar
    parameters: {
      's': {
        // BUG: type of RG does not match KV reference
        reference: bp.properties.resourceGroups.bar
      }
    }
    resourceGroups: {
    }
  }
}

Additional context
Originally discovered via #3084 but issue is independent of additionalProperties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions