Skip to content

Commit

Permalink
feat: avm/res/dev-test-lab/lab Enable Artifact repo Security Token …
Browse files Browse the repository at this point in the history
…on the parent module & uplift to leverage UDTs (#3102)

## Description

Closes #3056 

- Enable `securityToken` from the parent module for artifacts
authentication.

**Module deployment history View**

![image](https://github.com/user-attachments/assets/1cf641ce-5855-4917-994a-5dc744ed5550)

**Child Module deployment history View**

![image](https://github.com/user-attachments/assets/e24bd2d7-537e-4f40-a396-f4a2dd35e5d6)

**Code view**

![image](https://github.com/user-attachments/assets/c95981c1-488e-43f6-aaef-59e9d2765e80)


- Uplift module to support User Defined Types (UDT)
- Leverage the `@export` feature of bicep to reduce code duplication for
UDT.
- Uplift module to `v0.3`
- Simplified `events` parameters.

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.dev-test-lab.lab](https://github.com/ahmadabdalla/bicep-registry-modules/actions/workflows/avm.res.dev-test-lab.lab.yml/badge.svg?branch=users%2Fahmad%2F3056_DTL)](https://github.com/ahmadabdalla/bicep-registry-modules/actions/workflows/avm.res.dev-test-lab.lab.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] Azure Verified Module updates:
- [x] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] 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

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
ahmadabdalla authored Aug 27, 2024
1 parent bb574a7 commit cabac47
Show file tree
Hide file tree
Showing 21 changed files with 3,093 additions and 516 deletions.
1,320 changes: 1,144 additions & 176 deletions avm/res/dev-test-lab/lab/README.md

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions avm/res/dev-test-lab/lab/artifactsource/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,13 @@ The folder containing Azure Resource Manager templates. Required if "folderPath"

- Required: No
- Type: string
- Default: `''`

### Parameter: `folderPath`

The folder containing artifacts. At least one folder path is required. Required if "armTemplateFolderPath" is empty.

- Required: No
- Type: string
- Default: `''`

### Parameter: `labName`

Expand All @@ -89,7 +87,6 @@ The artifact source's branch reference (e.g. main or master).

- Required: No
- Type: string
- Default: `''`

### Parameter: `displayName`

Expand All @@ -105,19 +102,16 @@ The security token to authenticate to the artifact source.

- Required: No
- Type: securestring
- Default: `''`

### Parameter: `sourceType`

The artifact source's type.

- Required: No
- Type: string
- Default: `''`
- Allowed:
```Bicep
[
''
'GitHub'
'StorageAccount'
'VsoGit'
Expand Down
21 changes: 10 additions & 11 deletions avm/res/dev-test-lab/lab/artifactsource/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,25 @@ param tags object?
param displayName string = name

@sys.description('Optional. The artifact source\'s branch reference (e.g. main or master).')
param branchRef string = ''
param branchRef string?

@sys.description('Conditional. The folder containing artifacts. At least one folder path is required. Required if "armTemplateFolderPath" is empty.')
param folderPath string = ''
param folderPath string?

@sys.description('Conditional. The folder containing Azure Resource Manager templates. Required if "folderPath" is empty.')
param armTemplateFolderPath string = ''
param armTemplateFolderPath string?

@sys.description('Optional. The security token to authenticate to the artifact source.')
@secure()
param securityToken string = ''
param securityToken string?

@allowed([
''
'GitHub'
'StorageAccount'
'VsoGit'
])
@sys.description('Optional. The artifact source\'s type.')
param sourceType string = ''
param sourceType string?

@allowed([
'Enabled'
Expand All @@ -58,11 +57,11 @@ resource artifactsource 'Microsoft.DevTestLab/labs/artifactsources@2018-09-15' =
tags: tags
properties: {
displayName: displayName
branchRef: !empty(branchRef) ? branchRef : null
folderPath: !empty(folderPath) ? folderPath : null
armTemplateFolderPath: !empty(armTemplateFolderPath) ? armTemplateFolderPath : null
securityToken: !empty(securityToken) ? securityToken : null
sourceType: !empty(sourceType) ? sourceType : null
branchRef: branchRef
folderPath: folderPath
armTemplateFolderPath: armTemplateFolderPath
securityToken: securityToken
sourceType: sourceType
status: status
uri: uri
}
Expand Down
25 changes: 12 additions & 13 deletions avm/res/dev-test-lab/lab/artifactsource/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "15552685312013632487"
"templateHash": "13904061272597362111"
},
"name": "DevTest Lab Artifact Sources",
"description": "This module deploys a DevTest Lab Artifact Source.\n\nAn artifact source allows you to create custom artifacts for the VMs in the lab, or use Azure Resource Manager templates to create a custom test environment. You must add a private Git repository for the artifacts or Resource Manager templates that your team creates. The repository can be hosted on GitHub or on Azure DevOps Services.",
"description": "This module deploys a DevTest Lab Artifact Source.\r\n\r\nAn artifact source allows you to create custom artifacts for the VMs in the lab, or use Azure Resource Manager templates to create a custom test environment. You must add a private Git repository for the artifacts or Resource Manager templates that your team creates. The repository can be hosted on GitHub or on Azure DevOps Services.",
"owner": "Azure/module-maintainers"
},
"parameters": {
Expand Down Expand Up @@ -41,37 +41,36 @@
},
"branchRef": {
"type": "string",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Optional. The artifact source's branch reference (e.g. main or master)."
}
},
"folderPath": {
"type": "string",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Conditional. The folder containing artifacts. At least one folder path is required. Required if \"armTemplateFolderPath\" is empty."
}
},
"armTemplateFolderPath": {
"type": "string",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Conditional. The folder containing Azure Resource Manager templates. Required if \"folderPath\" is empty."
}
},
"securityToken": {
"type": "securestring",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Optional. The security token to authenticate to the artifact source."
}
},
"sourceType": {
"type": "string",
"defaultValue": "",
"nullable": true,
"allowedValues": [
"",
"GitHub",
"StorageAccount",
"VsoGit"
Expand Down Expand Up @@ -112,11 +111,11 @@
"tags": "[parameters('tags')]",
"properties": {
"displayName": "[parameters('displayName')]",
"branchRef": "[if(not(empty(parameters('branchRef'))), parameters('branchRef'), null())]",
"folderPath": "[if(not(empty(parameters('folderPath'))), parameters('folderPath'), null())]",
"armTemplateFolderPath": "[if(not(empty(parameters('armTemplateFolderPath'))), parameters('armTemplateFolderPath'), null())]",
"securityToken": "[if(not(empty(parameters('securityToken'))), parameters('securityToken'), null())]",
"sourceType": "[if(not(empty(parameters('sourceType'))), parameters('sourceType'), null())]",
"branchRef": "[parameters('branchRef')]",
"folderPath": "[parameters('folderPath')]",
"armTemplateFolderPath": "[parameters('armTemplateFolderPath')]",
"securityToken": "[parameters('securityToken')]",
"sourceType": "[parameters('sourceType')]",
"status": "[parameters('status')]",
"uri": "[parameters('uri')]"
},
Expand Down
2 changes: 0 additions & 2 deletions avm/res/dev-test-lab/lab/cost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ Reporting cycle end date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z)

- Required: No
- Type: string
- Default: `''`

### Parameter: `cycleStartDateTime`

Reporting cycle start date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z). Required if cycleType is set to "Custom".

- Required: No
- Type: string
- Default: `''`

### Parameter: `labName`

Expand Down
4 changes: 2 additions & 2 deletions avm/res/dev-test-lab/lab/cost/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ param cycleType string
param tags object?

@sys.description('Conditional. Reporting cycle start date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z). Required if cycleType is set to "Custom".')
param cycleStartDateTime string = ''
param cycleStartDateTime string?

@sys.description('Conditional. Reporting cycle end date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z). Required if cycleType is set to "Custom".')
param cycleEndDateTime string = ''
param cycleEndDateTime string?

@allowed([
'Enabled'
Expand Down
8 changes: 4 additions & 4 deletions avm/res/dev-test-lab/lab/cost/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "16348143074487982445"
"templateHash": "7509251296299887127"
},
"name": "DevTest Lab Costs",
"description": "This module deploys a DevTest Lab Cost.\n\nManage lab costs by setting a spending target that can be viewed in the Monthly Estimated Cost Trend chart. DevTest Labs can send a notification when spending reaches the specified target threshold.",
"description": "This module deploys a DevTest Lab Cost.\r\n\r\nManage lab costs by setting a spending target that can be viewed in the Monthly Estimated Cost Trend chart. DevTest Labs can send a notification when spending reaches the specified target threshold.",
"owner": "Azure/module-maintainers"
},
"parameters": {
Expand Down Expand Up @@ -38,14 +38,14 @@
},
"cycleStartDateTime": {
"type": "string",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Conditional. Reporting cycle start date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z). Required if cycleType is set to \"Custom\"."
}
},
"cycleEndDateTime": {
"type": "string",
"defaultValue": "",
"nullable": true,
"metadata": {
"description": "Conditional. Reporting cycle end date in the zulu time format (e.g. 2023-12-01T00:00:00.000Z). Required if cycleType is set to \"Custom\"."
}
Expand Down
Loading

0 comments on commit cabac47

Please sign in to comment.