-
Notifications
You must be signed in to change notification settings - Fork 753
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
Linter rule to enforce "strict" keyword order #6602
Comments
Would agree here, as we're managing a lot of bicep files with our team I think it would favor consistency. |
after reading the idea over here... https://github.com/orgs/Azure/projects/115/views/19 I rarely run into any issues with the "ordering" of my module keys. What I do find bothersome is the syntax differences between resources and modules. It makes it "tricky" (i dont want to say harder, but harder then it needs to be) to convert from using a resource to a module. I would prefer that the whole module syntax be more compatible with the resource syntex. Given the following resource, a number of changes need to be made to make it a "module". CurrentlyBeforeARM Template - main.bicepresource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: 'examplestorage'
location: 'eastus'
sku: {
name: 'Standard_LRS'
tier: 'Standard'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
}
} After
ARM Template - main.bicepmodule stg 'storageAccounts.bicep' = {
name: 'examplestorage'
params: {
location: 'eastus'
sku_name: 'Standard_LRS'
sku_tier: 'Standard'
kind: 'StorageV2'
accessTier: 'Hot'
}
} Module File - storageAccounts.bicepparam name string
param location string
param sku_name string
param sku_tier string
param kind string = 'StorageV2'
param accessTier string = 'Hot'
resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: name
location: location
sku: {
name: sku_name
tier: sku_tier
}
kind: kind
properties: {
accessTier: accessTier
}
} ProposedEnable removing the need for the "paras" key from Bicep modules completely. (for backwards compatibility, having a params key should still be allowed, but users should not be able to mix and match) Lastly, I should be able to use any ARM object type as a bicep type, instead of being limited to object. Without this, I need to pop every key of properties into its own new parameter. I can try to use the object type, but it becomes very complicated if a user wants to override some, but not all the defaults. main.bicepmodule stg './storageAccounts.bicep' = {
name: 'examplestorage'
location: 'eastus'
sku: {
name: 'Standard_LRS'
tier: 'Standard'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
}
} Module Fileparam location
param sku Sku = {
name: 'Standard_LRS'
tier: 'Standard'
}
param kind string = 'StorageV2'
param properties StorageAccountPropertiesCreateParametersOrStorageAccountProperties = {
accessTier: 'Hot'
}
resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: name
location: location
sku: sku
kind: kind
properties: properties
} sku |
Params and outputs should be grouped together, params should be at the top, outputs should either be underneath params or at the bottom of the file.
Open question whether this should also enforce strict ordering of
module
,resource
, orvar
.The text was updated successfully, but these errors were encountered: