vm-win from gitlab
This commit is contained in:
@@ -73,7 +73,7 @@ resource "azurerm_windows_virtual_machine" "vm" {
|
||||
https = false
|
||||
timeout = "3m"
|
||||
}
|
||||
source = "${path.module}/scripts"
|
||||
source = "${path.module}/main"
|
||||
destination = "C:/provision"
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ resource "azurerm_windows_virtual_machine" "vm" {
|
||||
}
|
||||
|
||||
inline = [
|
||||
"powershell.exe -File C:/provision/prep-files.ps1",
|
||||
"powershell.exe -File C:/provision/bootstrap.ps1"
|
||||
]
|
||||
}
|
||||
|
||||
29
vm-win/main/prep-files.ps1
Normal file
29
vm-win/main/prep-files.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
Param(
|
||||
[string] $repo="qmi-cloud-tf-modules",
|
||||
[string] $branch="master",
|
||||
[string] $scenario="vm-win",
|
||||
[string] $path="scripts"
|
||||
)
|
||||
|
||||
$pathIs="$scenario/$path"
|
||||
|
||||
$DownloadUrl="https://gitlab.com/qmi/$repo/-/archive/$branch/$repo-$branch.zip?path=$pathIs"
|
||||
|
||||
Write-Host "--- Boostrap# Downloading repository files from branch ($branch)..."
|
||||
|
||||
New-Item -ItemType Directory -Force -Path C:\Temp | Out-Null
|
||||
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
(New-Object System.Net.WebClient).DownloadFile($DownloadUrl, "C:\Temp\$scenario.zip")
|
||||
|
||||
Expand-Archive "C:\Temp\$scenario.zip" -DestinationPath "C:\Temp" -Force
|
||||
|
||||
New-Item -ItemType Directory -Force -Path C:\Provision | Out-Null
|
||||
|
||||
Copy-Item -Path "C:\Temp\$repo-$branch-$scenario-scripts\$scenario\$path\*" -Destination "C:\Provision" -Recurse -Force
|
||||
|
||||
Remove-Item "C:\Temp\$repo-$branch-$scenario-scripts" -Recurse
|
||||
Remove-Item "C:\Temp\$scenario.zip" -Recurse
|
||||
Reference in New Issue
Block a user