Skip to content

Commit

Permalink
fix: Fixed test for System-Assigned Identity output (#4112)
Browse files Browse the repository at this point in the history
## Description

- Fixed test to work with avm-common-types
- Added more tests to validate that the output exactly matches the UDT.
For example
  - Should be a string
  - Should be nullable
  - Should not have a default value
- Regenerated docs

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |

[![avm.res.key-vault.vault](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml/badge.svg?branch=users%2Falsehr%2FudtTestFix&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml)

[![avm.res.data-factory.factory](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.data-factory.factory.yml/badge.svg?branch=users%2Falsehr%2FudtTestFix&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.data-factory.factory.yml)

## Type of Change

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

- [x] 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: Benjamin P. Jung <b.jung@qvest-digital.com>
Co-authored-by: Benjamin P. Jung <headcr4sh@gmail.com>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent 8ad13c9 commit 50ac9d2
Show file tree
Hide file tree
Showing 104 changed files with 474 additions and 430 deletions.
4 changes: 2 additions & 2 deletions avm/res/api-management/service/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.6",
"version": "0.7",
"pathFilters": [
"./main.json"
]
}
}
2 changes: 1 addition & 1 deletion avm/res/app/container-app/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ output resourceGroupName string = resourceGroup().name
output name string = containerApp.name

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = containerApp.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = containerApp.?identity.?principalId

@description('The location the resource was deployed into.')
output location string = containerApp.location
Expand Down
7 changes: 4 additions & 3 deletions avm/res/app/container-app/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "16393853788129161391"
"version": "0.33.13.18514",
"templateHash": "10576304396294722473"
},
"name": "Container Apps",
"description": "This module deploys a Container App."
Expand Down Expand Up @@ -1108,10 +1108,11 @@
},
"systemAssignedMIPrincipalId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('containerApp', '2024-10-02-preview', 'full'), 'identity'), 'principalId'), '')]"
"value": "[tryGet(tryGet(reference('containerApp', '2024-10-02-preview', 'full'), 'identity'), 'principalId')]"
},
"location": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion avm/res/app/job/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.5",
"version": "0.6",
"pathFilters": [
"./main.json"
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/app/managed-environment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ output name string = managedEnvironment.name
output resourceId string = managedEnvironment.id

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = managedEnvironment.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = managedEnvironment.?identity.?principalId

@description('The Default domain of the Managed Environment.')
output defaultDomain string = managedEnvironment.properties.defaultDomain
Expand Down
9 changes: 5 additions & 4 deletions avm/res/app/managed-environment/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "15540000443534992861"
"version": "0.33.13.18514",
"templateHash": "4503904336969657185"
},
"name": "App ManagedEnvironments",
"description": "This module deploys an App Managed Environment (also known as a Container App Environment)."
Expand Down Expand Up @@ -398,7 +398,7 @@
"resources": {
"managedEnvironment::storage": {
"copy": {
"name": "storage",
"name": "managedEnvironment::storage",
"count": "[length(coalesce(parameters('storages'), createArray()))]"
},
"type": "Microsoft.App/managedEnvironments/storages",
Expand Down Expand Up @@ -556,10 +556,11 @@
},
"systemAssignedMIPrincipalId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('managedEnvironment', '2024-02-02-preview', 'full'), 'identity'), 'principalId'), '')]"
"value": "[tryGet(tryGet(reference('managedEnvironment', '2024-02-02-preview', 'full'), 'identity'), 'principalId')]"
},
"defaultDomain": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion avm/res/app/managed-environment/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.8",
"version": "0.9",
"pathFilters": [
"./main.json"
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/cache/redis/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ output sslPort int = redis.properties.sslPort
output subnetResourceId string = !empty(subnetResourceId) ? redis.properties.subnetId : ''

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = redis.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = redis.?identity.?principalId

@description('The location the resource was deployed into.')
output location string = redis.location
Expand Down
15 changes: 8 additions & 7 deletions avm/res/cache/redis/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "17904749553568757682"
"version": "0.33.13.18514",
"templateHash": "6280028405930372235"
},
"name": "Redis Cache",
"description": "This module deploys a Redis Cache."
Expand Down Expand Up @@ -1931,8 +1931,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "395538410437204745"
"version": "0.33.13.18514",
"templateHash": "11294861621866290910"
},
"name": "Redis Cache Linked Servers",
"description": "This module connects a primary and secondary Redis Cache together for geo-replication."
Expand Down Expand Up @@ -2057,8 +2057,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "9992767491398107530"
"version": "0.33.13.18514",
"templateHash": "14045530027687796477"
}
},
"definitions": {
Expand Down Expand Up @@ -2223,10 +2223,11 @@
},
"systemAssignedMIPrincipalId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('redis', '2024-11-01', 'full'), 'identity'), 'principalId'), '')]"
"value": "[tryGet(tryGet(reference('redis', '2024-11-01', 'full'), 'identity'), 'principalId')]"
},
"location": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion avm/res/cdn/profile/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ output endpointId string = !empty(endpointProperties) ? profile_endpoint.outputs
output uri string = !empty(endpointProperties) ? profile_endpoint.outputs.uri : ''

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = profile.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = profile.?identity.?principalId

@description('The list of records required for custom domains validation.')
output dnsValidation dnsValidationType[] = [
Expand Down
55 changes: 28 additions & 27 deletions avm/res/cdn/profile/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7113649683631462027"
"version": "0.33.13.18514",
"templateHash": "2568064534163012915"
},
"name": "CDN Profiles",
"description": "This module deploys a CDN Profile."
Expand Down Expand Up @@ -1331,8 +1331,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "9549854961484064285"
"version": "0.33.13.18514",
"templateHash": "9667828946590224838"
},
"name": "CDN Profiles Endpoints",
"description": "This module deploys a CDN Profile Endpoint."
Expand Down Expand Up @@ -1447,8 +1447,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "13720707069401173773"
"version": "0.33.13.18514",
"templateHash": "14207274905612158052"
},
"name": "CDN Profiles Endpoints Origins",
"description": "This module deploys a CDN Profile Endpoint Origin."
Expand Down Expand Up @@ -1692,8 +1692,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "8122410068056305563"
"version": "0.33.13.18514",
"templateHash": "6185880578813937844"
},
"name": "CDN Profiles Secret",
"description": "This module deploys a CDN Profile Secret."
Expand Down Expand Up @@ -1841,8 +1841,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "10872254821030072983"
"version": "0.33.13.18514",
"templateHash": "13058047826352389276"
},
"name": "CDN Profiles Custom Domains",
"description": "This module deploys a CDN Profile Custom Domains."
Expand Down Expand Up @@ -2130,8 +2130,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "2255246560564651285"
"version": "0.33.13.18514",
"templateHash": "2309166106272805364"
},
"name": "CDN Profiles Origin Group",
"description": "This module deploys a CDN Profile Origin Group."
Expand Down Expand Up @@ -2473,8 +2473,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "12548128435491978362"
"version": "0.33.13.18514",
"templateHash": "4615820934914726240"
},
"name": "CDN Profiles Origin",
"description": "This module deploys a CDN Profile Origin."
Expand Down Expand Up @@ -2774,8 +2774,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "16187656524256202445"
"version": "0.33.13.18514",
"templateHash": "832720268679200418"
},
"name": "CDN Profiles Rule Sets",
"description": "This module deploys a CDN Profile rule set."
Expand Down Expand Up @@ -2932,8 +2932,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "5126669469544382460"
"version": "0.33.13.18514",
"templateHash": "4778641008462766741"
},
"name": "CDN Profiles Rules",
"description": "This module deploys a CDN Profile rule."
Expand Down Expand Up @@ -3160,8 +3160,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "13135731354374453249"
"version": "0.33.13.18514",
"templateHash": "8177824551774407436"
},
"name": "CDN Profiles AFD Endpoints",
"description": "This module deploys a CDN Profile AFD Endpoint."
Expand Down Expand Up @@ -3534,8 +3534,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "14731142764965944373"
"version": "0.33.13.18514",
"templateHash": "5263422487313973220"
},
"name": "CDN Profiles AFD Endpoint Route",
"description": "This module deploys a CDN Profile AFD Endpoint route."
Expand Down Expand Up @@ -3831,7 +3831,7 @@
},
"profile::customDomains": {
"copy": {
"name": "customDomains",
"name": "profile::customDomains",
"count": "[length(coalesce(parameters('customDomainNames'), createArray()))]"
},
"existing": true,
Expand All @@ -3847,7 +3847,7 @@
},
"profile::ruleSet": {
"copy": {
"name": "ruleSet",
"name": "profile::ruleSet",
"count": "[length(parameters('ruleSets'))]"
},
"existing": true,
Expand Down Expand Up @@ -4013,8 +4013,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "11785514765749998247"
"version": "0.33.13.18514",
"templateHash": "9521724516599685420"
},
"name": "CDN Profiles Security Policy",
"description": "This module deploys a CDN Profile Security Policy."
Expand Down Expand Up @@ -4197,10 +4197,11 @@
},
"systemAssignedMIPrincipalId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('profile', '2023-05-01', 'full'), 'identity'), 'principalId'), '')]"
"value": "[tryGet(tryGet(reference('profile', '2023-05-01', 'full'), 'identity'), 'principalId')]"
},
"dnsValidation": {
"type": "array",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/cdn/profile/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.11",
"version": "0.12",
"pathFilters": [
"./main.json"
]
}
}
2 changes: 1 addition & 1 deletion avm/res/communication/communication-service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ output resourceGroupName string = resourceGroup().name
output location string = communicationService.location

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = communicationService.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = communicationService.?identity.?principalId

// ================ //
// Definitions //
Expand Down
7 changes: 4 additions & 3 deletions avm/res/communication/communication-service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "605200063153991260"
"version": "0.33.13.18514",
"templateHash": "1289592582463975402"
},
"name": "Communication Services",
"description": "This module deploys a Communication Service"
Expand Down Expand Up @@ -485,10 +485,11 @@
},
"systemAssignedMIPrincipalId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('communicationService', '2023-04-01', 'full'), 'identity'), 'principalId'), '')]"
"value": "[tryGet(tryGet(reference('communicationService', '2023-04-01', 'full'), 'identity'), 'principalId')]"
}
}
}
2 changes: 1 addition & 1 deletion avm/res/communication/communication-service/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.2",
"version": "0.3",
"pathFilters": [
"./main.json"
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/compute/disk-encryption-set/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ output name string = diskEncryptionSet.name
output resourceGroupName string = resourceGroup().name

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = diskEncryptionSet.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = diskEncryptionSet.?identity.?principalId

@description('The idenities of the disk encryption set.')
output identities object = diskEncryptionSet.identity
Expand Down
Loading

0 comments on commit 50ac9d2

Please sign in to comment.