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

Detect and provide warning for usage of "/providers/" in the type string #1941

Closed
anthony-c-martin opened this issue Mar 19, 2021 · 2 comments · Fixed by #1943
Closed

Detect and provide warning for usage of "/providers/" in the type string #1941

anthony-c-martin opened this issue Mar 19, 2021 · 2 comments · Fixed by #1943
Labels
enhancement New feature or request story: linter

Comments

@anthony-c-martin
Copy link
Member

The pattern of formatting type strings using "/providers/" is very pervasive in ARM template samples, so it would be great if we could provide a guiding error message on how to use the "scope" property instead to declare extension resources (with a documentation link).

As far as I'm aware, '/providers/' is reserved in ARM, and RPs cannot use it to declare a genuine resource type, so this feels safe. Something to confirm, of course.

As an example:

resource 'Microsoft.ContainerRegistry/registries/providers/roleAssignments' = {
//                                               ~~~~~~~~~ we should be able to warn about this
  ...
}

Should be replaced by the following (where registry is a reference to a new or existing Microsoft.ContainerRegistry/registries resource):

resource 'Microsoft.Authorization/roleAssignments' = {
  scope: registry
  ...
}

Some examples of confusion this could help prevent:
#784 (comment)
#784 (comment)
#784 (comment)
#784 (comment)
#784 (comment)
#1936
#1935
#1703

@alex-frankel
Copy link
Collaborator

Seems like a good use of the linter cc @MarcusFelling @jfleisher

@anthony-c-martin
Copy link
Member Author

Seems like a good use of the linter cc @MarcusFelling @jfleisher

I've already got the fix PR out as I'm keen to get it into the upcoming release to stop the confusion. Definitely open to moving this into the linter out in the future however.

@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request story: linter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants