Skip to content

name: last(split(resourceId, '/'))! is fixed by removing exclamation mark#3377

Closed
paggarwalmsft wants to merge 3 commits intoAzure:mainfrom
paggarwalmsft:main
Closed

name: last(split(resourceId, '/'))! is fixed by removing exclamation mark#3377
paggarwalmsft wants to merge 3 commits intoAzure:mainfrom
paggarwalmsft:main

Conversation

@paggarwalmsft
Copy link
Copy Markdown
Contributor

@paggarwalmsft paggarwalmsft commented Jun 26, 2023

Description

Thank you for your contribution !

name: last(split(resourceId, '/'))! here exclamation mark was causing error "Error BCP236: Expected a new line or comma character at this location."

Pipeline references

For module/pipeline changes, please create and attach the status badge of your successful run.

Pipeline

Type of Change

Please delete options that are not relevant.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

@paggarwalmsft paggarwalmsft requested a review from a team as a code owner June 26, 2023 18:45

resource AzureADDS 'Microsoft.AAD/DomainServices@2021-05-01' existing = {
name: last(split(resourceId, '/'))!
name: last(split(resourceId, '/'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @paggarwalmsft, could you kindly provide more info on the error you are experiencing? E.g., is it when deploying locally or through pipelines? Which bicep version are you using to deploy?

Copy link
Copy Markdown
Contributor

@AlexanderSehr AlexanderSehr Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Echoing @eriquas comment, this character was added to align with a specific null-checker linter rule (see this PR). That being said, maybe they changed their rules yet again. At least I cannot reproduce the linter warning when removing the ! locally either. I'll try to find out if there is some documented update of the rule set.

Like Erika said, please let us know which Bicep CLI version you're using (bicep -version).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bicep CLI version 0.18.4 (1620479ac6)

@AlexanderSehr
Copy link
Copy Markdown
Contributor

Following a joint investigation, we established that the issue was introduced with a new Linter Rule back in January (ref PR). As the modules were updated in accordance with the new rule, older Bicep versions would not be compatible (which essentially leads to the raised warning).
After agreeing with @paggarwalmsft I'll go ahead and close this PR as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants