Skip to content
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
16 changes: 8 additions & 8 deletions docs/wiki/[User-Guide]-Quick-Start-Phase-2-Azure-DevOps.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output
```

```pwsh
# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down Expand Up @@ -89,14 +89,14 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output
```

```pwsh
# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down
16 changes: 8 additions & 8 deletions docs/wiki/[User-Guide]-Quick-Start-Phase-2-GitHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output

# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down Expand Up @@ -81,12 +81,12 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output

# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down
16 changes: 8 additions & 8 deletions docs/wiki/[User-Guide]-Quick-Start-Phase-2-Local.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output

# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down Expand Up @@ -74,14 +74,14 @@ Although you can just run `Deploy-Accelerator` and fill out the prompted inputs,

```pwsh
# Windows
New-Item c:\accelerator\config\inputs.yaml -Force
New-Item c:\accelerator\output
New-Item -ItemType "file" c:\accelerator\config\inputs.yaml -Force
New-Item -ItemType "directory" c:\accelerator\output
```

```pwsh
# Linux/Mac
New-Item ~/accelerator/config/inputs.yaml -Force
New-Item ~/accelerator/output
New-Item -ItemType "file" ~/accelerator/config/inputs.yaml -Force
New-Item -ItemType "directory" ~/accelerator/output
```

```plaintext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/Azure/ALZ-PowerShell-Module/wiki/%5BUser-Guide%5D-Quick-Start-Phase-2-Azure-DevOps#2211-azure-devops-with-bicep

# Basic Inputs
iac: "bicep"
iac: "terraform"
bootstrap: "alz_local"
starter: "complete"

Expand Down
38 changes: 23 additions & 15 deletions src/ALZ/Private/Legacy-Bicep/New-ALZEnvironmentBicep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ function New-ALZEnvironmentBicep {
[switch] $local,

[Parameter(Mandatory = $false)]
[switch] $autoApprove
[switch] $autoApprove,

[Parameter(Mandatory = $false)]
[switch] $replaceFiles
)

if ($PSCmdlet.ShouldProcess("ALZ-Bicep module configuration", "modify")) {
Expand All @@ -33,22 +36,27 @@ function New-ALZEnvironmentBicep {
Write-Verbose "Config path: $configFilePath"
$bicepConfig = Get-ALZConfig -configFilePath $configFilePath

Write-InformationColored "Copying ALZ-Bicep module to $targetDirectory" -ForegroundColor Green -InformationAction Continue
Copy-ALZParametersFile -alzEnvironmentDestination $targetDirectory -upstreamReleaseDirectory $upstreamReleaseFolderPath -configFiles $bicepConfig.config_files | Out-String | Write-Verbose
Copy-ALZParametersFile -alzEnvironmentDestination $targetDirectory -upstreamReleaseDirectory $upstreamReleaseFolderPath -configFiles $bicepConfig.cicd.$vcs | Out-String | Write-Verbose

$configuration = Request-ALZEnvironmentConfig -configurationParameters $bicepConfig.parameters -userInputOverrides $userInputOverrides -autoApprove:$autoApprove.IsPresent

Set-ComputedConfiguration -configuration $configuration | Out-String | Write-Verbose
Edit-ALZConfigurationFilesInPlace -alzEnvironmentDestination $targetDirectory -configuration $configuration | Out-String | Write-Verbose
Build-ALZDeploymentEnvFile -configuration $configuration -Destination $targetDirectory -version $upstreamReleaseVersion | Out-String | Write-Verbose
Add-AvailabilityZonesBicepParameter -alzEnvironmentDestination $targetDirectory -zonesSupport $bicepConfig.zonesSupport | Out-String | Write-Verbose

if($local) {
# Check if the configuration directory exists
$configDirectory = Join-Path -Path $targetDirectory -ChildPath "config"
if (-not (Test-Path -Path $configDirectory) -or $replaceFiles.IsPresent) {
Write-InformationColored "Copying ALZ-Bicep module to $targetDirectory" -ForegroundColor Green -InformationAction Continue
Copy-ALZParametersFile -alzEnvironmentDestination $targetDirectory -upstreamReleaseDirectory $upstreamReleaseFolderPath -configFiles $bicepConfig.config_files | Out-String | Write-Verbose
Copy-ALZParametersFile -alzEnvironmentDestination $targetDirectory -upstreamReleaseDirectory $upstreamReleaseFolderPath -configFiles $bicepConfig.cicd.$vcs | Out-String | Write-Verbose
$configuration = Request-ALZEnvironmentConfig -configurationParameters $bicepConfig.parameters -userInputOverrides $userInputOverrides -autoApprove:$autoApprove.IsPresent

Set-ComputedConfiguration -configuration $configuration | Out-String | Write-Verbose
Edit-ALZConfigurationFilesInPlace -alzEnvironmentDestination $targetDirectory -configuration $configuration | Out-String | Write-Verbose
Build-ALZDeploymentEnvFile -configuration $configuration -Destination $targetDirectory -version $upstreamReleaseVersion | Out-String | Write-Verbose
Add-AvailabilityZonesBicepParameter -alzEnvironmentDestination $targetDirectory -zonesSupport $bicepConfig.zonesSupport | Out-String | Write-Verbose

} else {
Write-InformationColored "Configuration directory $configDirectory already exists and the replacefiles parameter is set to $replaceFiles. Will skil overwriting the config directory." -ForegroundColor Yellow -InformationAction Continue
}
if ($local) {
$isGitRepo = Test-ALZGitRepository -alzEnvironmentDestination $targetDirectory -autoApprove:$autoApprove.IsPresent
if (-not $isGitRepo) {
Write-InformationColored "The directory $targetDirectory is not a git repository. Please make sure it is a git repo after initialization." -ForegroundColor Red -InformationAction Continue
Write-InformationColored "The directory $targetDirectory is not a git repository. Please make sure it is a git repo after initialization." -ForegroundColor Red -InformationAction Continue
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/ALZ/Private/Shared/Get-GithubRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,16 @@ function Get-GithubRelease {
Remove-Item -Path "$targetVersionPath/tmp" -Force -Recurse
Write-InformationColored "The directory for $targetVersionPath has been created and populated." -ForegroundColor Green -InformationAction Continue
} else {
Write-InformationColored "The directory for $targetVersionPath already exists and has content in it, so we are not over-writing it." -ForegroundColor Green -InformationAction Continue
Write-InformationColored "The directory for $targetVersionPath already exists and has content in it, so we are not overwriting it." -ForegroundColor Green -InformationAction Continue
Write-Verbose "===> Content already exists in $releaseDirectory. Skipping"
}

# Check and replace the .env file release version if it is Bicep
$envFilePath = Join-Path -Path $parentDirectory -ChildPath ".env"
if(Test-Path $envFilePath) {
if (Test-Path $envFilePath) {
Write-Verbose "===> Replacing the .env file release version with $releaseTag"
(Get-Content $envFilePath) -replace "UPSTREAM_RELEASE_VERSION=.*", "UPSTREAM_RELEASE_VERSION=$releaseTag" | Set-Content $envFilePath
}

return $releaseTag
}
}
35 changes: 17 additions & 18 deletions src/ALZ/Public/New-ALZEnvironment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function New-ALZEnvironment {
[Alias("b")]
[string] $bootstrap = "",


[Parameter(Mandatory = $false, HelpMessage = "The starter module to deploy. You will be prompted to enter this if not supplied.")]
[string] $starter = "",

Expand Down Expand Up @@ -123,36 +122,36 @@ function New-ALZEnvironment {
if ($PSCmdlet.ShouldProcess("Accelerator setup", "modify")) {
# Get User Inputs from the -inputs file
$userInputOverrides = $null
if($userInputOverridePath -ne "") {
if ($userInputOverridePath -ne "") {
$userInputOverrides = Get-ALZConfig -configFilePath $userInputOverridePath
}

# Get the IAC type if not specified
if($iac -eq "") {
if ($iac -eq "") {
$iac = Request-SpecialInput -type "iac" -userInputOverrides $userInputOverrides
}

# Setup the Bicep flag
$isLegacyBicep = $false
if($iac -eq "bicep") {
if ($iac -eq "bicep") {
$isLegacyBicep = $bicepLegacyMode -eq $true
}

if($isLegacyBicep) {
if ($isLegacyBicep) {
Write-Verbose "We are running in legacy Bicep mode"
}

if(!$isLegacyBicep){
if (!$isLegacyBicep) {
Write-Verbose "We are running in modern mode"
}

# Check and install Terraform CLI if needed
if(!$isLegacyBicep) {
if($skipInternetChecks) {
if (!$isLegacyBicep) {
if ($skipInternetChecks) {
Write-InformationColored "Skipping Terraform tool check as you used the skipInternetCheck parameter. Please ensure you have the most recent version of Terraform installed" -ForegroundColor Yellow -InformationAction Continue
} else {
Write-InformationColored "Checking you have the latest version of Terraform installed..." -ForegroundColor Green -NewLineBefore -InformationAction Continue
if($iac -eq "bicep") {
if ($iac -eq "bicep") {
Write-InformationColored "Although you have selected Bicep, the Accelerator leverages the Terraform tool to bootstrap your Version Control System and Azure. This is will not impact your choice of Bicep post this initial bootstrap. Please refer to our documentation for further details..." -ForegroundColor Yellow -InformationAction Continue
}
$toolsPath = Join-Path -Path $targetDirectory -ChildPath ".tools"
Expand All @@ -165,7 +164,7 @@ function New-ALZEnvironment {
$bootstrapPath = ""
$bootstrapTargetFolder = "bootstrap"

if(!$isLegacyBicep) {
if (!$isLegacyBicep) {
Write-InformationColored "Checking and Downloading the bootstrap module..." -ForegroundColor Green -NewLineBefore -InformationAction Continue

$versionAndPath = New-ModuleSetup `
Expand All @@ -187,8 +186,9 @@ function New-ALZEnvironment {
$starterFolder = "starter"

$starterModuleTargetFolder = $starterFolder
if($isLegacyBicep) {
if ($isLegacyBicep) {
$starterModuleTargetFolder = "./upstream-releases"
$starterFolder = ""
}

# Setup the variables for bootstrap and starter modules
Expand All @@ -203,7 +203,7 @@ function New-ALZEnvironment {
$inputConfig = $null
$zonesSupport = $null

if(!$isLegacyBicep) {
if (!$isLegacyBicep) {
$bootstrapAndStarterConfig = Get-BootstrapAndStarterConfig `
-iac $iac `
-bootstrap $bootstrap `
Expand All @@ -221,18 +221,17 @@ function New-ALZEnvironment {
$inputConfig = $bootstrapAndStarterConfig.inputConfig
$zonesSupport = $bootstrapAndStarterConfig.zonesSupport
} else {
if($bootstrap -eq "") {
if ($bootstrap -eq "") {
$bootstrap = Request-SpecialInput -type "bootstrap" -bootstrapModules $bootstrapModules -userInputOverrides $userInputOverrides
}
}

# Download the starter modules
$starterReleaseTag = ""
$starterPath = ""
$starterConfig = $null

if(($hasStarterModule -or $isLegacyBicep)) {
Write-InformationColored "Checking and Downloading the starter module..." -ForegroundColor Green -NewLineBefore -InformationAction Continue
if (($hasStarterModule -or $isLegacyBicep)) {
Write-InformationColored "Checking and downloading the starter module..." -ForegroundColor Green -NewLineBefore -InformationAction Continue

$versionAndPath = New-ModuleSetup `
-targetDirectory $targetDirectory `
Expand All @@ -247,7 +246,7 @@ function New-ALZEnvironment {

$starterReleaseTag = $versionAndPath.releaseTag
$starterPath = $versionAndPath.path
if($starterConfigFilePath -ne "") {
if ($starterConfigFilePath -ne "") {
$starterConfig = Get-StarterConfig -starterPath $starterPath -starterConfigPath $starterConfigFilePath
}
}
Expand All @@ -273,7 +272,7 @@ function New-ALZEnvironment {
}

# Run the bootstrap
if(!$isLegacyBicep) {
if (!$isLegacyBicep) {

# Set computed interface inputs
$computedInputs = @{
Expand Down
Loading