Skip to content

Commit 65a30ac

Browse files
feat: ResourceGraph-Query - Updated UDTs to pending specs (#4109)
## Description Updated user-defined types with pending Azure/Azure-Verified-Modules#1738 & #4098. ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> | Pipeline | | -------- | [![avm.res.resource-graph.query](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resource-graph.query.yml/badge.svg?branch=users%2Falsehr%2FresourceGraph-query_udt&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.resource-graph.query.yml) ## 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
1 parent 7868a5a commit 65a30ac

File tree

5 files changed

+97
-141
lines changed

5 files changed

+97
-141
lines changed

avm/res/resource-graph/query/README.md

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This module deploys a Resource Graph Query.
88
- [Usage examples](#Usage-examples)
99
- [Parameters](#Parameters)
1010
- [Outputs](#Outputs)
11+
- [Cross-referenced modules](#Cross-referenced-modules)
1112
- [Data Collection](#Data-Collection)
1213

1314
## Resource Types
@@ -46,8 +47,6 @@ module query 'br/public:avm/res/resource-graph/query:<version>' = {
4647
// Required parameters
4748
name: 'rdsmin001'
4849
query: 'Resources | limit 10'
49-
// Non-required parameters
50-
location: '<location>'
5150
}
5251
}
5352
```
@@ -70,10 +69,6 @@ module query 'br/public:avm/res/resource-graph/query:<version>' = {
7069
},
7170
"query": {
7271
"value": "Resources | limit 10"
73-
},
74-
// Non-required parameters
75-
"location": {
76-
"value": "<location>"
7772
}
7873
}
7974
}
@@ -92,8 +87,6 @@ using 'br/public:avm/res/resource-graph/query:<version>'
9287
// Required parameters
9388
param name = 'rdsmin001'
9489
param query = 'Resources | limit 10'
95-
// Non-required parameters
96-
param location = '<location>'
9790
```
9891

9992
</details>
@@ -277,10 +270,6 @@ module query 'br/public:avm/res/resource-graph/query:<version>' = {
277270
name: 'rdswaf001'
278271
query: 'resourcecontainers| where type == \'microsoft.resources/subscriptions\' | take 5'
279272
// Non-required parameters
280-
location: '<location>'
281-
lock: {
282-
kind: 'None'
283-
}
284273
queryDescription: 'An example query to list first 5 subscriptions.'
285274
tags: {
286275
Environment: 'Non-Prod'
@@ -311,14 +300,6 @@ module query 'br/public:avm/res/resource-graph/query:<version>' = {
311300
"value": "resourcecontainers| where type == \"microsoft.resources/subscriptions\" | take 5"
312301
},
313302
// Non-required parameters
314-
"location": {
315-
"value": "<location>"
316-
},
317-
"lock": {
318-
"value": {
319-
"kind": "None"
320-
}
321-
},
322303
"queryDescription": {
323304
"value": "An example query to list first 5 subscriptions."
324305
},
@@ -347,10 +328,6 @@ using 'br/public:avm/res/resource-graph/query:<version>'
347328
param name = 'rdswaf001'
348329
param query = 'resourcecontainers| where type == \'microsoft.resources/subscriptions\' | take 5'
349330
// Non-required parameters
350-
param location = '<location>'
351-
param lock = {
352-
kind: 'None'
353-
}
354331
param queryDescription = 'An example query to list first 5 subscriptions.'
355332
param tags = {
356333
Environment: 'Non-Prod'
@@ -575,6 +552,14 @@ Resource tags.
575552
| `resourceGroupName` | string | The resource group the query was deployed into. |
576553
| `resourceId` | string | The resource ID of the query. |
577554

555+
## Cross-referenced modules
556+
557+
This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).
558+
559+
| Reference | Type |
560+
| :-- | :-- |
561+
| `br/public:avm/utl/types/avm-common-types:0.5.1` | Remote reference |
562+
578563
## Data Collection
579564

580565
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

avm/res/resource-graph/query/main.bicep

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ param name string
1212
@description('Optional. Location for all resources.')
1313
param location string = resourceGroup().location
1414

15+
import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
1516
@description('Optional. The lock settings of the service.')
16-
param lock lockType
17+
param lock lockType?
1718

19+
import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.5.1'
1820
@description('Optional. Array of role assignments to create.')
19-
param roleAssignments roleAssignmentType
21+
param roleAssignments roleAssignmentType[]?
2022

2123
@description('Optional. Resource tags.')
2224
param tags object?
@@ -134,41 +136,3 @@ output resourceGroupName string = resourceGroup().name
134136

135137
@description('The location the resource was deployed into.')
136138
output location string = rgQuery.location
137-
138-
// =============== //
139-
// Definitions //
140-
// =============== //
141-
142-
type lockType = {
143-
@description('Optional. Specify the name of lock.')
144-
name: string?
145-
146-
@description('Optional. Specify the type of lock.')
147-
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
148-
}?
149-
150-
type roleAssignmentType = {
151-
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
152-
name: string?
153-
154-
@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
155-
roleDefinitionIdOrName: string
156-
157-
@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
158-
principalId: string
159-
160-
@description('Optional. The principal type of the assigned principal ID.')
161-
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?
162-
163-
@description('Optional. The description of the role assignment.')
164-
description: string?
165-
166-
@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
167-
condition: string?
168-
169-
@description('Optional. Version of the condition.')
170-
conditionVersion: '2.0'?
171-
172-
@description('Optional. The Resource Id of the delegated managed identity resource.')
173-
delegatedManagedIdentityResourceId: string?
174-
}[]?

avm/res/resource-graph/query/main.json

Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"metadata": {
66
"_generator": {
77
"name": "bicep",
8-
"version": "0.29.47.4906",
9-
"templateHash": "15439682235813635403"
8+
"version": "0.32.4.45862",
9+
"templateHash": "2209176819138807055"
1010
},
1111
"name": "Resource Graph Queries",
1212
"description": "This module deploys a Resource Graph Query.",
@@ -36,80 +36,87 @@
3636
}
3737
}
3838
},
39-
"nullable": true
39+
"metadata": {
40+
"description": "An AVM-aligned type for a lock.",
41+
"__bicep_imported_from!": {
42+
"sourceTemplate": "br:mcr.microsoft.com/bicep/avm/utl/types/avm-common-types:0.5.1"
43+
}
44+
}
4045
},
4146
"roleAssignmentType": {
42-
"type": "array",
43-
"items": {
44-
"type": "object",
45-
"properties": {
46-
"name": {
47-
"type": "string",
48-
"nullable": true,
49-
"metadata": {
50-
"description": "Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated."
51-
}
52-
},
53-
"roleDefinitionIdOrName": {
54-
"type": "string",
55-
"metadata": {
56-
"description": "Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'."
57-
}
58-
},
59-
"principalId": {
60-
"type": "string",
61-
"metadata": {
62-
"description": "Required. The principal ID of the principal (user/group/identity) to assign the role to."
63-
}
64-
},
65-
"principalType": {
66-
"type": "string",
67-
"allowedValues": [
68-
"Device",
69-
"ForeignGroup",
70-
"Group",
71-
"ServicePrincipal",
72-
"User"
73-
],
74-
"nullable": true,
75-
"metadata": {
76-
"description": "Optional. The principal type of the assigned principal ID."
77-
}
78-
},
79-
"description": {
80-
"type": "string",
81-
"nullable": true,
82-
"metadata": {
83-
"description": "Optional. The description of the role assignment."
84-
}
85-
},
86-
"condition": {
87-
"type": "string",
88-
"nullable": true,
89-
"metadata": {
90-
"description": "Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase \"foo_storage_container\"."
91-
}
92-
},
93-
"conditionVersion": {
94-
"type": "string",
95-
"allowedValues": [
96-
"2.0"
97-
],
98-
"nullable": true,
99-
"metadata": {
100-
"description": "Optional. Version of the condition."
101-
}
102-
},
103-
"delegatedManagedIdentityResourceId": {
104-
"type": "string",
105-
"nullable": true,
106-
"metadata": {
107-
"description": "Optional. The Resource Id of the delegated managed identity resource."
108-
}
47+
"type": "object",
48+
"properties": {
49+
"name": {
50+
"type": "string",
51+
"nullable": true,
52+
"metadata": {
53+
"description": "Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated."
54+
}
55+
},
56+
"roleDefinitionIdOrName": {
57+
"type": "string",
58+
"metadata": {
59+
"description": "Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'."
60+
}
61+
},
62+
"principalId": {
63+
"type": "string",
64+
"metadata": {
65+
"description": "Required. The principal ID of the principal (user/group/identity) to assign the role to."
66+
}
67+
},
68+
"principalType": {
69+
"type": "string",
70+
"allowedValues": [
71+
"Device",
72+
"ForeignGroup",
73+
"Group",
74+
"ServicePrincipal",
75+
"User"
76+
],
77+
"nullable": true,
78+
"metadata": {
79+
"description": "Optional. The principal type of the assigned principal ID."
80+
}
81+
},
82+
"description": {
83+
"type": "string",
84+
"nullable": true,
85+
"metadata": {
86+
"description": "Optional. The description of the role assignment."
87+
}
88+
},
89+
"condition": {
90+
"type": "string",
91+
"nullable": true,
92+
"metadata": {
93+
"description": "Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase \"foo_storage_container\"."
94+
}
95+
},
96+
"conditionVersion": {
97+
"type": "string",
98+
"allowedValues": [
99+
"2.0"
100+
],
101+
"nullable": true,
102+
"metadata": {
103+
"description": "Optional. Version of the condition."
104+
}
105+
},
106+
"delegatedManagedIdentityResourceId": {
107+
"type": "string",
108+
"nullable": true,
109+
"metadata": {
110+
"description": "Optional. The Resource Id of the delegated managed identity resource."
109111
}
110112
}
111113
},
112-
"nullable": true
114+
"metadata": {
115+
"description": "An AVM-aligned type for a role assignment.",
116+
"__bicep_imported_from!": {
117+
"sourceTemplate": "br:mcr.microsoft.com/bicep/avm/utl/types/avm-common-types:0.5.1"
118+
}
119+
}
113120
}
114121
},
115122
"parameters": {
@@ -128,12 +135,17 @@
128135
},
129136
"lock": {
130137
"$ref": "#/definitions/lockType",
138+
"nullable": true,
131139
"metadata": {
132140
"description": "Optional. The lock settings of the service."
133141
}
134142
},
135143
"roleAssignments": {
136-
"$ref": "#/definitions/roleAssignmentType",
144+
"type": "array",
145+
"items": {
146+
"$ref": "#/definitions/roleAssignmentType"
147+
},
148+
"nullable": true,
137149
"metadata": {
138150
"description": "Optional. Array of role assignments to create."
139151
}

avm/res/resource-graph/query/tests/e2e/defaults/main.test.bicep

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ module testDeployment '../../../main.bicep' = {
4040
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}'
4141
params: {
4242
name: '${namePrefix}${serviceShort}001'
43-
location: resourceLocation
4443
query: 'Resources | limit 10'
4544
}
4645
}

avm/res/resource-graph/query/tests/e2e/waf-aligned/main.test.bicep

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ module testDeployment '../../../main.bicep' = {
4040
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}'
4141
params: {
4242
name: '${namePrefix}${serviceShort}001'
43-
location: resourceLocation
44-
lock: {
45-
kind: 'None'
46-
}
4743
tags: {
4844
'hidden-title': 'This is visible in the resource name'
4945
Environment: 'Non-Prod'

0 commit comments

Comments
 (0)