Skip to content

Commit eacbec3

Browse files
authored
feat: Integration of AVM based alz-bicep-accelerator (#456)
# Pull Request ## Description This pull request introduces support for the new "Bicep AVM" framework alongside the existing "Bicep Classic" and "Terraform" options for Azure Landing Zones. The changes update documentation, parameter handling, and logic throughout the codebase to enable users to select and deploy using any of these Infrastructure as Code approaches. **Documentation and User Experience Improvements:** * Updated `README.md` to clarify supported IaC types, now listing "bicep-avm" (Bicep AVM), "bicep" (Bicep Classic), and "terraform", with links and descriptions for each approach. * Improved user input options in `Request-SpecialInput` to distinguish between "Bicep AVM" (new framework) and "Bicep Classic" (classic framework), ensuring clear selection for users. * Updated help messages in `Deploy-Accelerator` to reflect the new supported IaC types, including "bicep-avm". **Core Logic and Configuration Updates:** * Modified logic in `New-Bootstrap` to handle both "bicep" and "bicep-avm" types for configuration conversion, file copying, and editing, ensuring both frameworks are supported throughout the deployment process. [[1]](diffhunk://#diff-f91dfbd454641bb81b16c9268caa2dd2ed4b48a9a7d0a68d497d69623b26d48aL146-R146) [[2]](diffhunk://#diff-f91dfbd454641bb81b16c9268caa2dd2ed4b48a9a7d0a68d497d69623b26d48aL251-R251) * Enhanced file retention logic in `New-Bootstrap` to include additional configuration directories (such as `.config`) for better compatibility with the new framework. **Robustness Improvements:** * Improved file retention logic in `Remove-UnrequiredFileSet` to skip null or empty values, preventing errors during cleanup operations. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent cd972db commit eacbec3

15 files changed

+102
-266
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ body:
4646
description: Which starter module are you using?
4747
multiple: false
4848
options:
49-
- bicep - complete
49+
- bicep - platform_landing_zone
5050
- terraform - platform_landing_zone
51-
- terraform - microsoft_cloud_for_sovereignty
52-
- terraform - microsoft_cloud_for_financial_services
5351
- other
5452
- not relevant
5553
validations:

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ body:
3333
description: Which starter module are you using?
3434
multiple: false
3535
options:
36-
- bicep - complete
36+
- bicep - platform_landing_zone
3737
- terraform - platform_landing_zone
38-
- terraform - microsoft_cloud_for_sovereignty
39-
- terraform - microsoft_cloud_for_financial_services
4038
- other
4139
- not relevant
4240
validations:

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@
88

99
## Introduction
1010

11-
This repository contains the PowerShell module and documentation for the Azure landing zones Accelerators for Bicep and Terraform. The accelerators are an opinionated implementation of the Azure Landing Zones Terraform modules, with Azure DevOps or GitHub bootstrapping.
11+
This repository contains the PowerShell module and documentation for the Azure landing zones Accelerators for Bicep and Terraform. The accelerators are an opinionated implementation of the Azure Landing Zones modules, with Azure DevOps or GitHub bootstrapping.
1212

13-
It is designed to be used as a template to enable you to get started quickly deploying ALZ with Bicep or Terraform.
13+
## Supported Infrastructure as Code (IaC) Types
14+
15+
The accelerators support multiple Infrastructure as Code approaches:
16+
17+
- **terraform**: Terraform-based Azure Landing Zones
18+
- **bicep**: Bicep-based Azure Landing Zones using the new [alz-bicep-accelerator](https://github.com/Azure/alz-bicep-accelerator) framework built on Azure Verified Modules
19+
- **bicep-classic**: Bicep-based Azure Landing Zones using the classic [ALZ-Bicep](https://github.com/Azure/ALZ-Bicep) framework
20+
21+
It is designed to be used as a template to enable you to get started quickly deploying ALZ with any of these approaches.
1422

1523
Please refer to our [Docs](https://aka.ms/alz/acc) for detailed features and usage instructions.
1624

src/ALZ/Private/Config-Helpers/Convert-BicepConfigToInputConfig.ps1

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ function Convert-BicepConfigToInputConfig {
44
[Parameter(Mandatory = $false)]
55
[PSCustomObject]$bicepConfig,
66

7-
[Parameter(Mandatory = $false)]
8-
[PSCustomObject]$validators,
9-
107
[Parameter(Mandatory = $false)]
118
[PSCustomObject]$appendToObject = $null
129
)
@@ -18,8 +15,6 @@ function Convert-BicepConfigToInputConfig {
1815
$configItems = $appendToObject
1916
}
2017

21-
Write-Verbose $validators
22-
2318
foreach ($variable in $bicepConfig.inputs.PSObject.Properties) {
2419
Write-Verbose "Parsing variable $($variable.Name)"
2520
$description = $variable.Value.description
@@ -45,20 +40,6 @@ function Convert-BicepConfigToInputConfig {
4540
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $defaultValue
4641
}
4742

48-
if ($variable.Value.PSObject.Properties.Name -contains "validation") {
49-
$validationType = $variable.Value.validation
50-
$validator = $validators.PSObject.Properties[$validationType].Value
51-
$description = "$description ($($validator.Description))"
52-
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)"
53-
if ($validator.Type -eq "AllowedValues") {
54-
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
55-
}
56-
if ($validator.Type -eq "Valid") {
57-
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
58-
}
59-
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
60-
}
61-
6243
if ($variable.Value.PSObject.Properties.Name -contains "targets") {
6344
$configItem | Add-Member -NotePropertyName "targets" -NotePropertyValue $variable.Value.targets
6445
}

src/ALZ/Private/Config-Helpers/Convert-HCLVariablesToInputConfig.ps1

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ function Convert-HCLVariablesToInputConfig {
77
[Parameter(Mandatory = $false)]
88
[string] $hclParserToolPath,
99

10-
[Parameter(Mandatory = $false)]
11-
[PSCustomObject]$validators,
12-
1310
[Parameter(Mandatory = $false)]
1411
[PSCustomObject]$appendToObject = $null
1512
)
@@ -32,19 +29,6 @@ function Convert-HCLVariablesToInputConfig {
3229
foreach ($variable in $terraformVariables.variable.PSObject.Properties) {
3330
if ($variable.Value[0].PSObject.Properties.Name -contains "description") {
3431
$description = $variable.Value[0].description
35-
$validationTypeSplit = $description -split "\|"
36-
37-
$hasValidation = $false
38-
39-
if ($validationTypeSplit.Length -gt 1) {
40-
$description = $validationTypeSplit[0].Trim()
41-
}
42-
43-
if ($validationTypeSplit.Length -eq 2) {
44-
$splitItem = $validationTypeSplit[1].Trim()
45-
$validationType = $splitItem
46-
$hasValidation = $true
47-
}
4832
}
4933

5034
$configItem = [PSCustomObject]@{}
@@ -55,18 +39,6 @@ function Convert-HCLVariablesToInputConfig {
5539
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $variable.Value[0].default
5640
}
5741

58-
if ($hasValidation) {
59-
$validator = $validators.PSObject.Properties[$validationType].Value
60-
$description = "$description ($($validator.Description))"
61-
if ($validator.Type -eq "AllowedValues") {
62-
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
63-
}
64-
if ($validator.Type -eq "Valid") {
65-
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
66-
}
67-
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
68-
}
69-
7042
$configItem | Add-Member -NotePropertyName "Description" -NotePropertyValue $description
7143

7244
Write-Verbose "Adding variable $($variable.Name) to the configuration..."

src/ALZ/Private/Config-Helpers/Remove-TerraformMetaFileSet.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ function Remove-TerraformMetaFileSet {
1919
)
2020

2121
if ($PSCmdlet.ShouldProcess("Remove files", "modify")) {
22+
Write-Verbose "Removing Terraform meta files and folders from $path"
23+
2224
if ($terraformFilesOrFoldersToRemove.Length -eq 0 ) {
23-
Write-Verbose "No folders or files specified, so not removing aything from $path"
25+
Write-Verbose "No folders or files specified, so not removing anything from $path"
2426
return
2527
}
2628

src/ALZ/Private/Config-Helpers/Remove-UnrequiredFileSet.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function Remove-UnrequiredFileSet {
2424
$fileRelativePath = $file.FullName.Replace($path, "").Replace("\", "/").TrimStart("/")
2525
$folderRelativePath = $file.Directory.FullName.Replace($path, "").Replace("\", "/").TrimStart("/")
2626
foreach ($folderOrFileToRetain in $foldersOrFilesToRetain) {
27+
# Skip null or empty values
28+
if ([string]::IsNullOrWhiteSpace($folderOrFileToRetain)) {
29+
continue
30+
}
2731
# If we have an exact match of the file name and path, always retain it.
2832
if ($folderOrFileToRetain.TrimStart("./") -eq $fileRelativePath) {
2933
if ($writeVerboseLogs) {

src/ALZ/Private/Config-Helpers/Request-SpecialInput.ps1

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/ALZ/Private/Config-Helpers/Set-Config.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ function Set-Config {
143143
continue
144144
}
145145

146-
# TODO: Add validation here...
147-
148146
# Use the default value if no input config is supplied
149147
if($configurationValue.Value.PSObject.Properties.Name -match "DefaultValue") {
150148
Write-Verbose "Input not supplied, so using default value of $($configurationValue.Value.DefaultValue) for $($configurationValue.Name)"

src/ALZ/Private/Deploy-Accelerator-Helpers/Copy-ParameterFileCollection.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function Copy-ParametersFileCollection {
1717
if (-not (Test-Path $destinationFolder)) {
1818
New-Item -ItemType Directory -Path $destinationFolder -Force | Out-String | Write-Verbose
1919
}
20+
Write-Verbose "Copying parameter file from $sourcePath to $destinationPath"
2021
Copy-Item -Path $sourcePath -Destination $destinationPath -Recurse -Force | Out-String | Write-Verbose
2122
}
2223
} else {

0 commit comments

Comments
 (0)