Skip to content

Commit 261ca6c

Browse files
fix: Bicep - Updated formatting and fixed outdated descriptors (#544)
1 parent 5ad765f commit 261ca6c

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

docs/static/includes/interfaces/int.cmk.udt.schema.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ resource cMKUserAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentiti
2929
scope: resourceGroup(split((customerManagedKey.?userAssignedIdentityResourceId ?? '//'), '/')[2], split((customerManagedKey.?userAssignedIdentityResourceId ?? '////'), '/')[4])
3030
}
3131

32-
resource exampleResoruce 'Example.Resource/example@2023-01-31' = {
33-
name: 'exampleResource'
32+
resource <singularMainResourceType> '<providerNamespace>/<resourceType>@<apiVersion>' = {
33+
name: '<exampleResource>'
3434
properties: {
3535
... // other properties
3636
encryption: !empty(customerManagedKey) ? {

docs/static/includes/interfaces/int.diag.udt.schema.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type diagnosticSettingType = {
3939
@description('Optional. The diagnostic settings of the service.')
4040
param diagnosticSettings diagnosticSettingType
4141

42-
resource exampleResourceDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for (diagnosticSetting, index) in (diagnosticSettings ?? []): {
42+
resource <singularMainResourceType>_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for (diagnosticSetting, index) in (diagnosticSettings ?? []): {
4343
name: diagnosticSetting.?name ?? '${name}-diagnosticSettings'
4444
properties: {
4545
storageAccountId: diagnosticSetting.?storageAccountResourceId
@@ -62,5 +62,5 @@ resource exampleResourceDiagnosticSettings 'Microsoft.Insights/diagnosticSetting
6262
marketplacePartnerId: diagnosticSetting.?marketplacePartnerResourceId
6363
logAnalyticsDestinationType: diagnosticSetting.?logAnalyticsDestinationType
6464
}
65-
scope: exampleResource
65+
scope: <singularMainResourceType>
6666
}]

docs/static/includes/interfaces/int.locks.udt.schema.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ type lockType = {
99
@description('Optional. The lock settings of the service.')
1010
param lock lockType
1111

12-
resource exampleResourceLock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
12+
resource <singularMainResourceType>_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
1313
name: lock.?name ?? 'lock-${name}'
1414
properties: {
1515
level: lock.?kind ?? ''
1616
notes: lock.?kind == 'CanNotDelete' ? 'Cannot delete resource or child resources.' : 'Cannot delete or modify the resource or child resources.'
1717
}
18-
scope: exampleResource
18+
scope: <singularMainResourceType>
1919
}

docs/static/includes/interfaces/int.mi.udt.schema.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ var identity = !empty(managedIdentities) ? {
1515
userAssignedIdentities: !empty(formattedUserAssignedIdentities) ? formattedUserAssignedIdentities : null
1616
} : null
1717

18-
resource exampleResource 'Example.Resource/example@2023-01-31' = {
19-
name: 'exampleResource'
18+
resource <singularMainResourceType> '<providerNamespace>/<resourceType>@<apiVersion>' = {
19+
name: name
2020
identity: identity
2121
properties: {
2222
... // other properties
2323
}
2424
}
2525

2626
@description('The principal ID of the system assigned identity.')
27-
output systemAssignedPrincipalId string = exampleResource.?identity.?principalId ?? ''
27+
output systemAssignedPrincipalId string = <singularMainResourceType>.?identity.?principalId ?? ''

docs/static/includes/interfaces/int.pe.udt.schema1.bicep

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type privateEndpointType = {
5555
@description('Optional. Specify the type of lock.')
5656
lock: lockType
5757

58-
@description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
58+
@description('Optional. Array of role assignments to create.')
5959
roleAssignments: roleAssignmentType
6060

6161
@description('Optional. Tags to be applied on all resources/resource groups in this deployment.')
@@ -71,22 +71,22 @@ type privateEndpointType = {
7171
@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
7272
param privateEndpoints privateEndpointType
7373

74-
module <exampleResource>PrivateEndpoint 'br/public:avm/res/network/private-endpoint:X.Y.Z' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
75-
name: '${uniqueString(deployment().name, location)}-<exampleResource>-PrivateEndpoint-${index}'
74+
module <singularMainResourceType>_privateEndpoints 'br/public:avm/res/network/private-endpoint:X.Y.Z' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
75+
name: '${uniqueString(deployment().name, location)}-<singularMainResourceType>-PrivateEndpoint-${index}'
7676
params: {
7777
// Variant 1: A default service can be assumed (i.e., for services that only have one private endpoint type)
7878
privateLinkServiceConnections: [
7979
{
8080
name: name
8181
properties: {
82-
privateLinkServiceId: <exampleResource>.id
82+
privateLinkServiceId: <singularMainResourceType>.id
8383
groupIds: [
8484
privateEndpoint.?service ?? '<defaultServiceName>'
8585
]
8686
}
8787
}
8888
]
89-
name: privateEndpoint.?name ?? 'pep-${last(split(<exampleResource>.id, '/'))}-${privateEndpoint.?service ?? '<defaultServiceName>'}-${index}'
89+
name: privateEndpoint.?name ?? 'pep-${last(split(<singularMainResourceType>.id, '/'))}-${privateEndpoint.?service ?? '<defaultServiceName>'}-${index}'
9090
subnetResourceId: privateEndpoint.subnetResourceId
9191
enableTelemetry: privateEndpoint.?enableTelemetry ?? enableTelemetry
9292
location: privateEndpoint.?location ?? reference(split(privateEndpoint.subnetResourceId, '/subnets/')[0], '2020-06-01', 'Full').location

docs/static/includes/interfaces/int.pe.udt.schema2.bicep

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type privateEndpointType = {
5555
@description('Optional. Specify the type of lock.')
5656
lock: lockType
5757

58-
@description('Optional. Array of role assignment objects that contain the \'roleDefinitionIdOrName\' and \'principalId\' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
58+
@description('Optional. Array of role assignments to create.')
5959
roleAssignments: roleAssignmentType
6060

6161
@description('Optional. Tags to be applied on all resources/resource groups in this deployment.')
@@ -71,22 +71,22 @@ type privateEndpointType = {
7171
@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
7272
param privateEndpoints privateEndpointType
7373

74-
module <exampleResource>PrivateEndpoint 'br/public:avm/res/network/private-endpoint:X.Y.Z' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
75-
name: '${uniqueString(deployment().name, location)}-<exampleResource>-PrivateEndpoint-${index}'
74+
module <singularMainResourceType>_privateEndpoints 'br/public:avm/res/network/private-endpoint:X.Y.Z' = [for (privateEndpoint, index) in (privateEndpoints ?? []): {
75+
name: '${uniqueString(deployment().name, location)}-<singularMainResourceType>-PrivateEndpoint-${index}'
7676
params: {
7777
// Variant 2: A default service cannot be assumed (i.e., for services that have more than one private endpoint type, like Storage Account)
7878
privateLinkServiceConnections: [
7979
{
8080
name: name
8181
properties: {
82-
privateLinkServiceId: <exampleResource>.id
82+
privateLinkServiceId: <singularMainResourceType>.id
8383
groupIds: [
8484
privateEndpoint.service
8585
]
8686
}
8787
}
8888
]
89-
name: privateEndpoint.?name ?? 'pep-${last(split(<exampleResourceSymbolicName>.id, '/'))}-${privateEndpoint.?service ?? privateEndpoint.service}-${index}'
89+
name: privateEndpoint.?name ?? 'pep-${last(split(<singularMainResourceType>.id, '/'))}-${privateEndpoint.?service ?? privateEndpoint.service}-${index}'
9090
subnetResourceId: privateEndpoint.subnetResourceId
9191
enableTelemetry: privateEndpoint.?enableTelemetry ?? enableTelemetry
9292
location: privateEndpoint.?location ?? reference(split(privateEndpoint.subnetResourceId, '/subnets/')[0], '2020-06-01', 'Full').location

docs/static/includes/interfaces/int.rbac.udt.schema.bicep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ var builtInRoleNames = {
3333
'User Access Administrator': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '18d7d88d-d35e-4fb5-a5c3-7773c20a72d9')
3434
}
3535

36-
resource exampleResourceRoleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for (roleAssignment, index) in (roleAssignments ?? []): {
37-
name: guid(exampleResource.id, roleAssignment.principalId, roleAssignment.roleDefinitionIdOrName)
36+
resource <singularMainResourceType>_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for (roleAssignment, index) in (roleAssignments ?? []): {
37+
name: guid(<singularMainResourceType>.id, roleAssignment.principalId, roleAssignment.roleDefinitionIdOrName)
3838
properties: {
3939
roleDefinitionId: contains(builtInRoleNames, roleAssignment.roleDefinitionIdOrName) ? builtInRoleNames[roleAssignment.roleDefinitionIdOrName] : contains(roleAssignment.roleDefinitionIdOrName, '/providers/Microsoft.Authorization/roleDefinitions/') ? roleAssignment.roleDefinitionIdOrName : subscriptionResourceId('Microsoft.Authorization/roleDefinitions', roleAssignment.roleDefinitionIdOrName)
4040
principalId: roleAssignment.principalId
@@ -44,5 +44,5 @@ resource exampleResourceRoleAssignments 'Microsoft.Authorization/roleAssignments
4444
conditionVersion: !empty(roleAssignment.?condition) ? (roleAssignment.?conditionVersion ?? '2.0') : null // Must only be set if condtion is set
4545
delegatedManagedIdentityResourceId: roleAssignment.?delegatedManagedIdentityResourceId
4646
}
47-
scope: exampleResource
47+
scope: <singularMainResourceType>
4848
}]

0 commit comments

Comments
 (0)