Skip to content

feat: ResourceGroup - Updated UDTs to pending specs #4108

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 9 additions & 30 deletions avm/res/resources/resource-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This module deploys a Resource Group.
- [Usage examples](#Usage-examples)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Data Collection](#Data-Collection)

## Resource Types
Expand Down Expand Up @@ -43,10 +44,7 @@ This instance deploys the module with the minimum set of required parameters.
module resourceGroup 'br/public:avm/res/resources/resource-group:<version>' = {
name: 'resourceGroupDeployment'
params: {
// Required parameters
name: 'avm-resources.resourcegroups-rrgmin-rg'
// Non-required parameters
location: '<location>'
}
}
```
Expand All @@ -63,13 +61,8 @@ module resourceGroup 'br/public:avm/res/resources/resource-group:<version>' = {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"name": {
"value": "avm-resources.resourcegroups-rrgmin-rg"
},
// Non-required parameters
"location": {
"value": "<location>"
}
}
}
Expand All @@ -85,10 +78,7 @@ module resourceGroup 'br/public:avm/res/resources/resource-group:<version>' = {
```bicep-params
using 'br/public:avm/res/resources/resource-group:<version>'

// Required parameters
param name = 'avm-resources.resourcegroups-rrgmin-rg'
// Non-required parameters
param location = '<location>'
```

</details>
Expand Down Expand Up @@ -264,11 +254,6 @@ module resourceGroup 'br/public:avm/res/resources/resource-group:<version>' = {
// Required parameters
name: 'avm-resources.resourcegroups-rrgwaf-rg'
// Non-required parameters
location: '<location>'
lock: {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
tags: {
Environment: 'Non-Prod'
'hidden-title': 'This is visible in the resource name'
Expand All @@ -295,15 +280,6 @@ module resourceGroup 'br/public:avm/res/resources/resource-group:<version>' = {
"value": "avm-resources.resourcegroups-rrgwaf-rg"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"lock": {
"value": {
"kind": "CanNotDelete",
"name": "myCustomLockName"
}
},
"tags": {
"value": {
"Environment": "Non-Prod",
Expand All @@ -328,11 +304,6 @@ using 'br/public:avm/res/resources/resource-group:<version>'
// Required parameters
param name = 'avm-resources.resourcegroups-rrgwaf-rg'
// Non-required parameters
param location = '<location>'
param lock = {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
param tags = {
Environment: 'Non-Prod'
'hidden-title': 'This is visible in the resource name'
Expand Down Expand Up @@ -532,6 +503,14 @@ Tags of the storage account resource.
| `name` | string | The name of the resource group. |
| `resourceId` | string | The resource ID of the resource group. |

## Cross-referenced modules

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).

| Reference | Type |
| :-- | :-- |
| `br/public:avm/utl/types/avm-common-types:0.4.1` | Remote reference |

## Data Collection

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.
44 changes: 4 additions & 40 deletions avm/res/resources/resource-group/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ param name string
@description('Optional. Location of the Resource Group. It uses the deployment\'s location when not provided.')
param location string = deployment().location

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.4.1'
@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?

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

@description('Optional. Tags of the storage account resource.')
param tags object?
Expand Down Expand Up @@ -75,41 +77,3 @@ output resourceId string = resourceGroup.id

@description('The location the resource was deployed into.')
output location string = resourceGroup.location

// =============== //
// Definitions //
// =============== //

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@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\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@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".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?
164 changes: 88 additions & 76 deletions avm/res/resources/resource-group/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "12280129054844550830"
"version": "0.32.4.45862",
"templateHash": "15310777892883158544"
},
"name": "Resource Groups",
"description": "This module deploys a Resource Group.",
Expand Down Expand Up @@ -36,80 +36,87 @@
}
}
},
"nullable": true
"metadata": {
"description": "An AVM-aligned type for a lock.",
"__bicep_imported_from!": {
"sourceTemplate": "br:mcr.microsoft.com/bicep/avm/utl/types/avm-common-types:0.4.1"
}
}
},
"roleAssignmentType": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated."
}
},
"roleDefinitionIdOrName": {
"type": "string",
"metadata": {
"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'."
}
},
"principalId": {
"type": "string",
"metadata": {
"description": "Required. The principal ID of the principal (user/group/identity) to assign the role to."
}
},
"principalType": {
"type": "string",
"allowedValues": [
"Device",
"ForeignGroup",
"Group",
"ServicePrincipal",
"User"
],
"nullable": true,
"metadata": {
"description": "Optional. The principal type of the assigned principal ID."
}
},
"description": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The description of the role assignment."
}
},
"condition": {
"type": "string",
"nullable": true,
"metadata": {
"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\"."
}
},
"conditionVersion": {
"type": "string",
"allowedValues": [
"2.0"
],
"nullable": true,
"metadata": {
"description": "Optional. Version of the condition."
}
},
"delegatedManagedIdentityResourceId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The Resource Id of the delegated managed identity resource."
}
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated."
}
},
"roleDefinitionIdOrName": {
"type": "string",
"metadata": {
"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'."
}
},
"principalId": {
"type": "string",
"metadata": {
"description": "Required. The principal ID of the principal (user/group/identity) to assign the role to."
}
},
"principalType": {
"type": "string",
"allowedValues": [
"Device",
"ForeignGroup",
"Group",
"ServicePrincipal",
"User"
],
"nullable": true,
"metadata": {
"description": "Optional. The principal type of the assigned principal ID."
}
},
"description": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The description of the role assignment."
}
},
"condition": {
"type": "string",
"nullable": true,
"metadata": {
"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\"."
}
},
"conditionVersion": {
"type": "string",
"allowedValues": [
"2.0"
],
"nullable": true,
"metadata": {
"description": "Optional. Version of the condition."
}
},
"delegatedManagedIdentityResourceId": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. The Resource Id of the delegated managed identity resource."
}
}
},
"nullable": true
"metadata": {
"description": "An AVM-aligned type for a role assignment.",
"__bicep_imported_from!": {
"sourceTemplate": "br:mcr.microsoft.com/bicep/avm/utl/types/avm-common-types:0.4.1"
}
}
}
},
"parameters": {
Expand All @@ -128,12 +135,17 @@
},
"lock": {
"$ref": "#/definitions/lockType",
"nullable": true,
"metadata": {
"description": "Optional. The lock settings of the service."
}
},
"roleAssignments": {
"$ref": "#/definitions/roleAssignmentType",
"type": "array",
"items": {
"$ref": "#/definitions/roleAssignmentType"
},
"nullable": true,
"metadata": {
"description": "Optional. Array of role assignments to create."
}
Expand Down Expand Up @@ -209,8 +221,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "16740360506283584978"
"version": "0.32.4.45862",
"templateHash": "1203907446887412297"
}
},
"definitions": {
Expand Down Expand Up @@ -295,8 +307,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "10992477577200576081"
"version": "0.32.4.45862",
"templateHash": "6029968255804453751"
}
},
"definitions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module testDeployment '../../../main.bicep' = [
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}'
params: {
name: 'avm-${namePrefix}-resources.resourcegroups-${serviceShort}-rg'
location: resourceLocation
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ param namePrefix string = '#_namePrefix_#'
module testDeployment '../../../main.bicep' = {
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}'
params: {
location: resourceLocation
name: 'avm-${namePrefix}-resources.resourcegroups-${serviceShort}-rg'
lock: {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
tags: {
'hidden-title': 'This is visible in the resource name'
Environment: 'Non-Prod'
Expand Down
Loading