Skip to content
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

top level array resource is not parsing. Error BCP018: Expected the "]" character at this location. #2393

Closed
masters3d opened this issue Apr 25, 2021 · 3 comments

Comments

@masters3d
Copy link
Contributor

Bicep version
run bicep --version via the Bicep CLI, az bicep version via the AZ CLI or via VS code by navigating to the extensions tab and searching for Bicep

Bicep CLI version 0.3.255 (589f037)

Describe the bug
A clear and concise description of what the bug is vs what you expected to happen

To Reproduce
Steps to reproduce the behavior:

run the below code. the single resource parses fine while the array does not. I have this same array code nested and parses fine.

resource authorization_r1 'Microsoft.Relay/namespaces/hybridConnections/authorizationRules@2017-04-01' = {
  name: 'some_namespace/some_connection/some_rule'
  properties: {
    rights: [ 
      'Listen'
      ] 
    }
}

resource authorization_rules 'Microsoft.Relay/namespaces/hybridConnections/authorizationRules@2017-04-01' = [for ignoring in range(0, 1): {
  name: 'some_namespace/some_connection/some_rule'
  properties: {
    rights: [ 
      'Listen'
      ] 
    }
} // Error BCP018: Expected the "]" character at this location.
] // Error BCP007: This declaration type is not recognized. Specify a parameter, variable, resource, or output declaration.

Additional context
Add any other context about the problem here.

@ghost ghost added the Needs: Triage 🔍 label Apr 25, 2021
@audhage
Copy link

audhage commented Apr 26, 2021

Isn't this newline sensitive? Putting the two last brackets on the same line resolves the problem.

@miqm
Copy link
Collaborator

miqm commented Apr 26, 2021

@audhage - the combination of }] in one line, next to each other, indicates end of loop. Perhaps the error message (BCP018) should be a little bit more descriptive and explain why we expect particular character.

@alex-frankel
Copy link
Collaborator

Bicep is newline sensitive. We are looking into ways we can remove this (#146) or decrease sensitivity for cases like this. Looks like @miqm provided the right fix so I'm going to close this, but let us know if there are issues or questions about what is happening.

@ghost ghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants