Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6728899

Browse filesBrowse files
enhancement: relocate bootstrap modules (Azure#105)
# Pull Request ## Issue Issue #, if available: N/A ## Description This PR is a significant refactor to de-couple bootstrap and starter modules. It moves to a configuration based approach for shared inputs and have many other enhancements to the user experience. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent 41a7a16 commit 6728899
Copy full SHA for 6728899
Expand file treeCollapse file tree

29 files changed

+1128
-607
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,42 @@ Thumbs.db
1414
src/ALZ/Assets/alz-bicep-internal/
1515
test_output/
1616
hcl2json_windows_amd64.exe
17+
18+
# Local .terraform directories
19+
**/.terraform/*
20+
21+
# .tfstate files
22+
*.tfstate
23+
*.tfstate.*
24+
**/.terraform.lock.hcl
25+
26+
# Crash log files
27+
crash.log
28+
29+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
30+
# .tfvars files are managed as part of configuration and so should be included in
31+
# version control.
32+
#
33+
# example.tfvars
34+
35+
# Ignore override files as they are usually used to override resources locally and so
36+
# are not checked in
37+
override.tf
38+
override.tf.json
39+
*_override.tf
40+
*_override.tf.json
41+
42+
# Include override files you do wish to add to version control using negated pattern
43+
#
44+
# !example_override.tf
45+
46+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
47+
# example: *tfplan*
48+
.terraform.lock.hcl
49+
terraform.log
50+
*.tfvars
51+
!terraform.tfvars
52+
templates/basic/terraform.tfvars
53+
templates/.test_azuredevops
54+
templates/.test_github
55+
.vscode/settings.json

‎README.md

Copy file name to clipboardExpand all lines: README.md
+20-25Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
# ALZ
1+
# ALZ / Accelerator PowerShell Module
22

33
[![license](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE)
44

55
![Logo](./docs/ALZLogo.png)
66

77
## Synopsis
88

9-
This is a PowerShell module that provides a set of cmdlets to create and manage Azure Landing Zones.
9+
This is a PowerShell module that provides a set of cmdlets to create and manage Accelerators for Azure Landing Zones and other workloads.
1010

1111
## Description
1212

13-
This module provides a set of cmdlets to create and manage Azure Landing Zones.
13+
This module provides a set of cmdlets to create and manage Accelerators for Azure Landing Zones and other workloads.
1414

1515
## Why
1616

17-
The goal of this project it is to make easy to get started with Azure Landing Zones and to speed up some basic tasks that you would need to perform whilst managing your Azure Landing Zones.
17+
The goal of this project it is to make easy to get started with Azure Landing Zones and other workloads. It is designed to speed up some basic tasks that you would need to perform whilst managing your Azure Landing Zones.
18+
19+
For usage of the Azure Landing Zoners Accelerators, please refer to the detailed documentation:
20+
21+
- [Bicep](https://github.com/Azure/ALZ-Bicep/wiki/Accelerator)
22+
- [Terraform](https://github.com/Azure/alz-terraform-accelerator/wiki)
1823

1924
## Getting Started
2025

@@ -24,11 +29,14 @@ In order to use this module you will need PowerShell 7.1 or higher.
2429
Download and install the latest version from the official PowerShell GitHub releases page: [PowerShell Releases](https://github.com/PowerShell/PowerShell/releases)
2530

2631
To make PowerShell 7 your default instead of version 5, consider setting an alias.
27-
Open a PowerShell session and run the following command:
28-
```powershell
32+
33+
Open a PowerShell session and run the following command:
34+
35+
```powershell
2936
$PSVersionTable.PSVersion
3037
Set-Alias powershell pwsh
3138
```
39+
3240
### Installation
3341

3442
You can install this module using PowerShellGet.
@@ -60,7 +68,7 @@ Before you start you can utilize the functionality of the module to verify if yo
6068
#### Bicep
6169

6270
```powershell
63-
Test-ALZRequirement -IaC "bicep"
71+
Test-ALZRequirement -i "bicep"
6472
```
6573

6674
Currently this tests for:
@@ -75,7 +83,7 @@ Currently this tests for:
7583
#### Terraform
7684

7785
```powershell
78-
Test-ALZRequirement -IaC "terraform"
86+
Test-ALZRequirement -i "terraform"
7987
```
8088

8189
This currently tests for:
@@ -88,38 +96,25 @@ This currently tests for:
8896
#### Azure Landing Zone Environment with Bicep and GitHub Actions Workflows
8997

9098
```powershell
91-
New-ALZEnvironment -o <output_directory> -i "bicep" -c "github"
99+
Deploy-Accelerator -o <output_directory> -i "bicep" -b "alz_github"
92100
```
93101

94102
#### Azure Landing Zone Environment with Bicep and Azure DevOps Pipelines
95103

96104
```powershell
97-
New-ALZEnvironment -o <output_directory> -i "bicep" -c "azuredevops"
105+
Deploy-Accelerator -o <output_directory> -i "bicep" -b "alz_azuredevops"
98106
```
99107

100-
> **Note**
101-
> Azure Devops Pipelines are only supported in v0.2.6 or later.
102-
103108
#### Azure Landing Zone Environment with Terraform and GitHub Pipelines
104109

105110
```powershell
106-
New-ALZEnvironment -o <output_directory> -i "terraform" -c "github"
111+
Deploy-Accelerator -o <output_directory> -i "terraform" -b "alz_github"
107112
```
108113

109114
#### Azure Landing Zone Environment with Terraform and Azure DevOps Pipelines
110115

111116
```powershell
112-
New-ALZEnvironment -o <output_directory> -i "terraform" -c "azuredevops"
113-
```
114-
115-
## Additional Cmdlets
116-
117-
### Update an existing Azure Landing Zone Environment
118-
119-
#### Downloads and pulls down the specified release version from the remote GitHub repository to a local directory
120-
121-
```powershell
122-
Get-ALZGithubRelease -i "bicep" -v "v0.14.0" -o "C:\Repos\ALZ\accelerator"
117+
Deploy-Accelerator -o <output_directory> -i "terraform" -b "alz_azuredevops"
123118
```
124119

125120
## Development

‎src/ALZ/ALZ.psd1

Copy file name to clipboardExpand all lines: src/ALZ/ALZ.psd1
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070

7171
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
7272
FunctionsToExport = @(
73-
'Get-ALZGithubRelease'
7473
'New-ALZEnvironment'
7574
'Test-ALZRequirement'
7675
'Edit-LineEnding'
@@ -85,6 +84,7 @@
8584
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
8685
AliasesToExport = @(
8786
'Edit-LineEndings'
87+
'Deploy-Accelerator'
8888
)
8989

9090
# DSC resources to export from this module

‎src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1

Copy file name to clipboardExpand all lines: src/ALZ/Private/Build-ALZDeploymentEnvFile.ps1
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Build-ALZDeploymentEnvFile {
2727
foreach ($configurationValue in $configuration.PsObject.Properties) {
2828
foreach ($target in $configurationValue.Value.Targets) {
2929
if ($target.Destination -eq "Environment") {
30-
Write-InformationColored $configurationValue.Name -ForegroundColor Green -InformationAction Continue
30+
Write-Verbose "Creating environment files for: $($configurationValue.Name)"
3131

3232
if($configurationValue.Name -eq "UpstreamReleaseVersion") {
3333
Add-Content -Path $envFile -Value "$($($target.Name))=`"$version`"" | Out-String | Write-Verbose

‎src/ALZ/Private/Convert-HCLVariablesToUserInputConfig.ps1

Copy file name to clipboardExpand all lines: src/ALZ/Private/Convert-HCLVariablesToUserInputConfig.ps1
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ function Convert-HCLVariablesToUserInputConfig {
1111
[PSCustomObject]$validators,
1212

1313
[Parameter(Mandatory = $false)]
14-
[PSCustomObject]$appendToObject = $null
14+
[PSCustomObject]$appendToObject = $null,
15+
16+
[Parameter(Mandatory = $false)]
17+
[switch]$allComputedInputs
1518
)
1619

1720
if ($PSCmdlet.ShouldProcess("Parse HCL Variables into Config", "modify")) {
@@ -49,12 +52,8 @@ function Convert-HCLVariablesToUserInputConfig {
4952
$hasValidation = $true
5053
}
5154

52-
if($hasValidation -and $validationType -eq "hidden") {
53-
continue
54-
}
55-
5655
$inputType = "UserInput"
57-
if($hasValidation -and $validationType -like "hidden_*") {
56+
if($allComputedInputs) {
5857
$inputType = "ComputedInput"
5958
}
6059

+72Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
function Convert-InterfaceInputToUserInputConfig {
2+
[CmdletBinding(SupportsShouldProcess = $true)]
3+
param (
4+
[Parameter(Mandatory = $false)]
5+
[PSCustomObject]$inputConfig,
6+
7+
[Parameter(Mandatory = $false)]
8+
[PSCustomObject]$validators,
9+
10+
[Parameter(Mandatory = $false)]
11+
[PSCustomObject]$appendToObject = $null
12+
)
13+
14+
if ($PSCmdlet.ShouldProcess("Parse Interface Variables into Config", "modify")) {
15+
16+
$starterModuleConfiguration = [PSCustomObject]@{}
17+
if($appendToObject -ne $null) {
18+
$starterModuleConfiguration = $appendToObject
19+
}
20+
21+
Write-Verbose $validators
22+
23+
foreach($variable in $inputConfig.inputs.PSObject.Properties) {
24+
Write-Verbose "Parsing variable $($variable.Name)"
25+
$description = $variable.Value.description
26+
27+
$order = 0
28+
if($variable.PSObject.Properties.Name -contains "display_order") {
29+
$order = $variable.Value.display_order
30+
}
31+
32+
$inputType = $variable.Value.source -eq "input" ? "UserInput" : "ComputedInput"
33+
$dataType = $variable.Value.type
34+
35+
$sensitive = $false
36+
if($variable.Value.PSObject.Properties.Name -contains "sensitive") {
37+
$sensitive = $variable.Value.sensitive
38+
}
39+
40+
$starterModuleConfigurationInstance = [PSCustomObject]@{}
41+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Order" -NotePropertyValue $order
42+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Type" -NotePropertyValue $inputType
43+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Value" -NotePropertyValue ""
44+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "DataType" -NotePropertyValue $dataType
45+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Sensitive" -NotePropertyValue $sensitive
46+
47+
if($variable.Value.PSObject.Properties.Name -contains "default") {
48+
$defaultValue = $variable.Value.default
49+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $defaultValue
50+
}
51+
52+
if($variable.Value.PSObject.Properties.Name -contains "validation") {
53+
$validationType = $variable.Value.validation
54+
$validator = $validators.PSObject.Properties[$validationType].Value
55+
$description = "$description ($($validator.Description))"
56+
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)"
57+
if($validator.Type -eq "AllowedValues"){
58+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
59+
}
60+
if($validator.Type -eq "Valid"){
61+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
62+
}
63+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
64+
}
65+
66+
$starterModuleConfigurationInstance | Add-Member -NotePropertyName "Description" -NotePropertyValue $description
67+
$starterModuleConfiguration | Add-Member -NotePropertyName $variable.Name -NotePropertyValue $starterModuleConfigurationInstance
68+
}
69+
}
70+
71+
return $starterModuleConfiguration
72+
}

‎src/ALZ/Private/Edit-ALZConfigurationFilesInPlace.ps1

Copy file name to clipboardExpand all lines: src/ALZ/Private/Edit-ALZConfigurationFilesInPlace.ps1
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function Edit-ALZConfigurationFilesInPlace {
7171
}
7272

7373
if ($true -eq $modified) {
74-
Write-InformationColored $file.FullName -ForegroundColor Yellow -InformationAction Continue
74+
Write-Verbose $file.FullName
7575
$bicepConfiguration | ConvertTo-Json -Depth 10 | Out-File $file.FullName
7676
}
7777
}

‎src/ALZ/Private/Get-ALZConfig.ps1

Copy file name to clipboardExpand all lines: src/ALZ/Private/Get-ALZConfig.ps1
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ function Get-ALZConfig {
3939
throw "The config file must be a json or yaml/yml file"
4040
}
4141

42+
Write-Verbose "Config file loaded from $configFilePath with $($config.PSObject.Properties.Count) properties."
4243
return $config
4344
}
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function Get-ExistingLocalRelease {
2+
param(
3+
[Parameter(Mandatory = $false)]
4+
[string] $targetDirectory,
5+
6+
[Parameter(Mandatory = $false)]
7+
[string] $targetFolder
8+
)
9+
10+
$releaseTag = ""
11+
$path = ""
12+
$checkPath = Join-Path $targetDirectory $targetFolder
13+
$checkFolders = Get-ChildItem -Path $checkPath -Directory
14+
if($null -ne $checkFolders) {
15+
$checkFolders = $checkFolders | Sort-Object { $_.Name } -Descending
16+
$mostRecentCheckFolder = $checkFolders[0]
17+
18+
$releaseTag = $mostRecentCheckFolder.Name
19+
$path = $mostRecentCheckFolder.FullName
20+
} else {
21+
Write-InformationColored "You have passed the skipInternetChecks parameter, but there is no existing version in the $targetFolder module, so we can't continue."
22+
throw
23+
}
24+
25+
return @{
26+
releaseTag = $releaseTag
27+
path = $path
28+
}
29+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.