Skip to content

Commit

Permalink
feat: Updated reamining templates with deployment-linter suppression (#…
Browse files Browse the repository at this point in the history
…2498)

## Description

Updated reamining templates with deployment-linter suppression

Replaces
- #2355
- #2353

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

---------

Co-authored-by: Erika Gressi <[email protected]>
Co-authored-by: Maher Aldineh <[email protected]>
  • Loading branch information
3 people authored Jul 4, 2024
1 parent 3d21e89 commit fb0d462
Show file tree
Hide file tree
Showing 173 changed files with 2,100 additions and 2,114 deletions.
32 changes: 26 additions & 6 deletions avm/ptn/authorization/policy-assignment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ param resourceSelectors array = []
@sys.description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: take('46d3xbcp.ptn.authorization-policyassignment.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}', 64)
#disable-next-line no-deployments-resources
resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) {
name: take(
'46d3xbcp.ptn.authorization-policyassignment.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}',
64
)
location: location
properties: {
mode: 'Incremental'
Expand Down Expand Up @@ -160,13 +164,29 @@ module policyAssignment_rg 'modules/resource-group.bicep' = if (!empty(resourceG
}

@sys.description('Policy Assignment Name.')
output name string = empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_mg.outputs.name : (!empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_sub.outputs.name : policyAssignment_rg.outputs.name)
output name string = empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_mg.outputs.name
: (!empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_sub.outputs.name
: policyAssignment_rg.outputs.name)

@sys.description('Policy Assignment principal ID.')
output principalId string = empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_mg.outputs.principalId : (!empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_sub.outputs.principalId : policyAssignment_rg.outputs.principalId)
output principalId string = empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_mg.outputs.principalId
: (!empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_sub.outputs.principalId
: policyAssignment_rg.outputs.principalId)

@sys.description('Policy Assignment resource ID.')
output resourceId string = empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_mg.outputs.resourceId : (!empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_sub.outputs.resourceId : policyAssignment_rg.outputs.resourceId)
output resourceId string = empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_mg.outputs.resourceId
: (!empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_sub.outputs.resourceId
: policyAssignment_rg.outputs.resourceId)

@sys.description('The location the resource was deployed into.')
output location string = empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_mg.outputs.location : (!empty(subscriptionId) && empty(resourceGroupName) ? policyAssignment_sub.outputs.location : policyAssignment_rg.outputs.location)
output location string = empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_mg.outputs.location
: (!empty(subscriptionId) && empty(resourceGroupName)
? policyAssignment_sub.outputs.location
: policyAssignment_rg.outputs.location)
18 changes: 9 additions & 9 deletions avm/ptn/authorization/policy-assignment/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "3274497359181095240"
"version": "0.28.1.47646",
"templateHash": "7409207305186624461"
},
"name": "Policy Assignments (All scopes)",
"description": "This module deploys a Policy Assignment at a Management Group, Subscription or Resource Group scope.",
Expand Down Expand Up @@ -158,7 +158,7 @@
{
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"apiVersion": "2024-03-01",
"name": "[take(format('46d3xbcp.ptn.authorization-policyassignment.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4)), 64)]",
"location": "[parameters('location')]",
"properties": {
Expand Down Expand Up @@ -226,8 +226,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "15016174258473942920"
"version": "0.28.1.47646",
"templateHash": "10754608594936413857"
},
"name": "Policy Assignments (Management Group scope)",
"description": "This module deploys a Policy Assignment at a Management Group scope.",
Expand Down Expand Up @@ -481,8 +481,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "977404313320239280"
"version": "0.28.1.47646",
"templateHash": "14066444680843928013"
},
"name": "Policy Assignments (Subscription scope)",
"description": "This module deploys a Policy Assignment at a Subscription scope.",
Expand Down Expand Up @@ -736,8 +736,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "17106923564853756802"
"version": "0.28.1.47646",
"templateHash": "17693268287104969526"
},
"name": "Policy Assignments (Resource Group scope)",
"description": "This module deploys a Policy Assignment at a Resource Group scope.",
Expand Down
3 changes: 2 additions & 1 deletion avm/ptn/authorization/resource-role-assignment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ param enableTelemetry bool = true
// Definitions //
// =============== //

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
#disable-next-line no-deployments-resources
resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) {
name: '46d3xbcp.ptn.authorization-resourceroleassignment.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name), 0, 4)}'
properties: {
mode: 'Incremental'
Expand Down
8 changes: 4 additions & 4 deletions avm/ptn/authorization/resource-role-assignment/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "17107961067773605935"
"version": "0.28.1.47646",
"templateHash": "17607291889971078318"
},
"name": "Resource-scoped role assignment",
"description": "This module deploys a Role Assignment for a specific resource.",
Expand Down Expand Up @@ -136,7 +136,7 @@
{
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"apiVersion": "2024-03-01",
"name": "[format('46d3xbcp.ptn.authorization-resourceroleassignment.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name), 0, 4))]",
"properties": {
"mode": "Incremental",
Expand Down Expand Up @@ -216,4 +216,4 @@
"value": "[resourceGroup().name]"
}
}
}
}
60 changes: 39 additions & 21 deletions avm/ptn/authorization/role-assignment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,25 @@ param principalType string = ''
@sys.description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
if (enableTelemetry) {
name: '46d3xbcp.ptn.authorization-roleassignment.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
#disable-next-line no-deployments-resources
resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) {
name: '46d3xbcp.ptn.authorization-roleassignment.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
}
}
location:location
}
location: location
}

module roleAssignment_mg 'modules/management-group.bicep' = if (empty(subscriptionId) && empty(resourceGroupName)) {
name: '${uniqueString(deployment().name, location)}-RoleAssignment-MG-Module'
Expand All @@ -80,7 +80,9 @@ module roleAssignment_mg 'modules/management-group.bicep' = if (empty(subscripti
managementGroupId: managementGroupId
description: !empty(description) ? description : ''
principalType: !empty(principalType) ? principalType : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId) ? delegatedManagedIdentityResourceId : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId)
? delegatedManagedIdentityResourceId
: ''
conditionVersion: conditionVersion
condition: !empty(condition) ? condition : ''
}
Expand All @@ -95,7 +97,9 @@ module roleAssignment_sub 'modules/subscription.bicep' = if (!empty(subscription
subscriptionId: subscriptionId
description: !empty(description) ? description : ''
principalType: !empty(principalType) ? principalType : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId) ? delegatedManagedIdentityResourceId : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId)
? delegatedManagedIdentityResourceId
: ''
conditionVersion: conditionVersion
condition: !empty(condition) ? condition : ''
}
Expand All @@ -111,17 +115,31 @@ module roleAssignment_rg 'modules/resource-group.bicep' = if (!empty(resourceGro
resourceGroupName: resourceGroupName
description: !empty(description) ? description : ''
principalType: !empty(principalType) ? principalType : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId) ? delegatedManagedIdentityResourceId : ''
delegatedManagedIdentityResourceId: !empty(delegatedManagedIdentityResourceId)
? delegatedManagedIdentityResourceId
: ''
conditionVersion: conditionVersion
condition: !empty(condition) ? condition : ''
}
}

@sys.description('The GUID of the Role Assignment.')
output name string = empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_mg.outputs.name : (!empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_sub.outputs.name : roleAssignment_rg.outputs.name)
output name string = empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_mg.outputs.name
: (!empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_sub.outputs.name
: roleAssignment_rg.outputs.name)

@sys.description('The resource ID of the Role Assignment.')
output resourceId string = empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_mg.outputs.resourceId : (!empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_sub.outputs.resourceId : roleAssignment_rg.outputs.resourceId)
output resourceId string = empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_mg.outputs.resourceId
: (!empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_sub.outputs.resourceId
: roleAssignment_rg.outputs.resourceId)

@sys.description('The scope this Role Assignment applies to.')
output scope string = empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_mg.outputs.scope : (!empty(subscriptionId) && empty(resourceGroupName) ? roleAssignment_sub.outputs.scope : roleAssignment_rg.outputs.scope)
output scope string = empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_mg.outputs.scope
: (!empty(subscriptionId) && empty(resourceGroupName)
? roleAssignment_sub.outputs.scope
: roleAssignment_rg.outputs.scope)
18 changes: 9 additions & 9 deletions avm/ptn/authorization/role-assignment/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "3360936249154372689"
"version": "0.28.1.47646",
"templateHash": "7625867886550880091"
},
"name": "Role Assignments (All scopes)",
"description": "This module deploys a Role Assignment at a Management Group, Subscription or Resource Group scope.",
Expand Down Expand Up @@ -110,7 +110,7 @@
{
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"apiVersion": "2024-03-01",
"name": "[format('46d3xbcp.ptn.authorization-roleassignment.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
Expand Down Expand Up @@ -164,8 +164,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "13749459126745145624"
"version": "0.28.1.47646",
"templateHash": "8906093264527258150"
},
"name": "Role Assignments (Management Group scope)",
"description": "This module deploys a Role Assignment at a Management Group scope.",
Expand Down Expand Up @@ -328,8 +328,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "4516670639800961845"
"version": "0.28.1.47646",
"templateHash": "707244099707019442"
},
"name": "Role Assignments (Subscription scope)",
"description": "This module deploys a Role Assignment at a Subscription scope.",
Expand Down Expand Up @@ -500,8 +500,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "7241874480439813582"
"version": "0.28.1.47646",
"templateHash": "14591941439222880522"
},
"name": "Role Assignments (Resource Group scope)",
"description": "This module deploys a Role Assignment at a Resource Group scope.",
Expand Down
68 changes: 32 additions & 36 deletions avm/ptn/finops-toolkit/finops-hub/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,11 @@ var storageAccountName = '${take(safeHubName, 24 - length(storageAccountSuffix))
var ftkVersion = '0.3'

// Add cm-resource-parent to group resources in Cost Management
var resourceTags = union(
tags ?? {},
{
'cm-resource-parent': '${resourceGroup().id}/providers/Microsoft.Cloud/hubs/${hubName}'
'ftk-version': ftkVersion
'ftk-tool': 'FinOps hubs'
}
)
var resourceTags = union(tags ?? {}, {
'cm-resource-parent': '${resourceGroup().id}/providers/Microsoft.Cloud/hubs/${hubName}'
'ftk-version': ftkVersion
'ftk-tool': 'FinOps hubs'
})

// Generate globally unique Data Factory name: 3-63 chars; letters, numbers, non-repeating dashes
var uniqueSuffix = uniqueString(hubName, resourceGroup().id)
Expand Down Expand Up @@ -158,43 +155,42 @@ module keyVault 'modules/keyVault.bicep' = {
}
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
if (enableTelemetry) {
name: '46d3xbcp.ptn.finopstoolkit-finopshub.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
#disable-next-line no-deployments-resources
resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) {
name: '46d3xbcp.ptn.finopstoolkit-finopshub.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
}
}
}
}

resource defaultTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
if (enableTelemetry) {
name: 'pid-${telemetryId}-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
metadata: {
_generator: {
name: 'FinOps toolkit'
version: '0.3'
}
resource defaultTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: 'pid-${telemetryId}-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
metadata: {
_generator: {
name: 'FinOps toolkit'
version: '0.3'
}
resources: []
}
resources: []
}
}
}

//==============================================================================
// Outputs
Expand Down
Loading

0 comments on commit fb0d462

Please sign in to comment.