Skip to content

Commit

Permalink
feat: avm/res/hybrid-compute/machine: use `avm/utl/types/avm-common…
Browse files Browse the repository at this point in the history
…-types` (#4153)

## Description

Use `avm/utl/types/avm-common-types` instead of duplicate definitions.
A few features are to be developed which depend on this. The unified
types will make cross-resource development easier.

## Pipeline Reference

| Pipeline |
| -------- |
|
[![avm.res.hybrid-compute.machine](https://github.com/DanteMustCode/bicep-registry-modules/actions/workflows/avm.res.hybrid-compute.machine.yml/badge.svg)](https://github.com/DanteMustCode/bicep-registry-modules/actions/workflows/avm.res.hybrid-compute.machine.yml)
|

## Type of Change

- [ ] 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.
- [x] 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

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

---------

Co-authored-by: Matthew Bratschun <[email protected]>
  • Loading branch information
DanteMustCode and mbrat2005 authored Jan 14, 2025
1 parent bee358a commit f4e8d09
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 154 deletions.
11 changes: 10 additions & 1 deletion avm/res/hybrid-compute/machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This module deploys an Arc Machine for use with Arc Resource Bridge for Azure St
- [Usage examples](#Usage-examples)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Data Collection](#Data-Collection)

## Resource Types
Expand All @@ -17,7 +18,7 @@ This module deploys an Arc Machine for use with Arc Resource Bridge for Azure St
| `Microsoft.Authorization/locks` | [2020-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-05-01/locks) |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.GuestConfiguration/guestConfigurationAssignments` | [2020-06-25](https://learn.microsoft.com/en-us/azure/templates/Microsoft.GuestConfiguration/2020-06-25/guestConfigurationAssignments) |
| `Microsoft.HybridCompute/machines` | [2024-03-31-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.HybridCompute/2024-03-31-preview/machines) |
| `Microsoft.HybridCompute/machines` | [2024-07-10](https://learn.microsoft.com/en-us/azure/templates/Microsoft.HybridCompute/2024-07-10/machines) |

## Usage examples

Expand Down Expand Up @@ -740,6 +741,14 @@ The GUID of the on-premises virtual machine from your hypervisor.
| `resourceId` | string | The resource ID of the machine. |
| `systemAssignedMIPrincipalId` | string | The principal ID of the system assigned identity. |

## 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.
2 changes: 1 addition & 1 deletion avm/res/hybrid-compute/machine/extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This module deploys a Arc Machine Extension. This module should be used as a sta

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.HybridCompute/machines/extensions` | [2024-03-31-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.HybridCompute/2024-03-31-preview/machines/extensions) |
| `Microsoft.HybridCompute/machines/extensions` | [2024-07-10](https://learn.microsoft.com/en-us/azure/templates/Microsoft.HybridCompute/2024-07-10/machines/extensions) |

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions avm/res/hybrid-compute/machine/extension/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ param enableAutomaticUpgrade bool
@description('Optional. Tags of the resource.')
param tags object?

resource machine 'Microsoft.HybridCompute/machines@2024-03-31-preview' existing = {
resource machine 'Microsoft.HybridCompute/machines@2024-07-10' existing = {
name: arcMachineName
}

resource extension 'Microsoft.HybridCompute/machines/extensions@2024-03-31-preview' = {
resource extension 'Microsoft.HybridCompute/machines/extensions@2024-07-10' = {
name: name
parent: machine
location: location
Expand Down
8 changes: 4 additions & 4 deletions avm/res/hybrid-compute/machine/extension/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7050591888814861236"
"templateHash": "2099029777392195135"
},
"name": "Arc Machine Extensions",
"description": "This module deploys a Arc Machine Extension. This module should be used as a standalone deployment after the Arc agent has connected to the Arc Machine resource.",
Expand Down Expand Up @@ -95,12 +95,12 @@
"machine": {
"existing": true,
"type": "Microsoft.HybridCompute/machines",
"apiVersion": "2024-03-31-preview",
"apiVersion": "2024-07-10",
"name": "[parameters('arcMachineName')]"
},
"extension": {
"type": "Microsoft.HybridCompute/machines/extensions",
"apiVersion": "2024-03-31-preview",
"apiVersion": "2024-07-10",
"name": "[format('{0}/{1}', parameters('arcMachineName'), parameters('name'))]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -143,7 +143,7 @@
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference('extension', '2024-03-31-preview', 'full').location]"
"value": "[reference('extension', '2024-07-10', 'full').location]"
}
}
}
54 changes: 5 additions & 49 deletions avm/res/hybrid-compute/machine/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ metadata name = 'Hybrid Compute Machines'
metadata description = 'This module deploys an Arc Machine for use with Arc Resource Bridge for Azure Stack HCI or VMware. In these scenarios, this resource module will be used in combination with another resource module to create the require Virtual Machine Instance extension resource on this Arc Machine resource. This module should not be used for other Arc-enabled server scenarios, where the Arc Machine resource is created automatically by the onboarding process.'
metadata owner = 'Azure/module-maintainers'

import { roleAssignmentType, lockType } from 'br/public:avm/utl/types/avm-common-types:0.4.1'

@description('Required. The name of the Arc machine to be created. You should use a unique prefix to reduce name collisions in Active Directory.')
param name string

Expand Down Expand Up @@ -57,10 +59,10 @@ param osType string?
param location string = resourceGroup().location

@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?

@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?

@description('Optional. Tags of the resource.')
param tags object?
Expand Down Expand Up @@ -147,7 +149,7 @@ resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableT
}
}

resource machine 'Microsoft.HybridCompute/machines@2024-03-31-preview' = {
resource machine 'Microsoft.HybridCompute/machines@2024-07-10' = {
name: name
location: location
identity: {
Expand Down Expand Up @@ -218,49 +220,3 @@ output systemAssignedMIPrincipalId string = machine.?identity.?principalId ?? ''

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

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

type managedIdentitiesType = {
@description('Optional. Enables system assigned managed identity on the resource.')
systemAssigned: bool?

@description('Optional. The resource ID(s) to assign to the resource.')
userAssignedResourceIds: string[]?
}?

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?
}[]?
Loading

0 comments on commit f4e8d09

Please sign in to comment.