open-nomad/e2e/terraform/packer/windows-2016-amd64/install-consul.ps1
Seth Hoenig 198e0d9f24 e2e: get consul ent in e2e packer builds
Using Consul Enterprise is going to be necessary for testing Nomad's
Consul Namespace integration in Nomad v1.1 in e2e.
2021-04-14 12:05:55 -06:00

33 lines
927 B
PowerShell
Executable file

Set-StrictMode -Version latest
$ErrorActionPreference = "Stop"
# Force TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Set-Location C:\opt
Try {
$releases = "https://releases.hashicorp.com"
$version = "1.9.4+ent"
$url = "${releases}/consul/${version}/consul_${version}_windows_amd64.zip"
New-Item -ItemType Directory -Force -Path C:\opt\consul
New-Item -ItemType Directory -Force -Path C:\opt\consul.d
# TODO: check sha!
Write-Output "Downloading Consul from: $url"
Invoke-WebRequest -Uri $url -Outfile consul.zip -ErrorAction Stop
Expand-Archive .\consul.zip .\ -ErrorAction Stop
Move-Item consul.exe C:\opt\consul.exe -Force -ErrorAction Stop
C:\opt\consul.exe version
rm consul.zip
} Catch {
Write-Output "Failed to install Consul."
Write-Output $_
$host.SetShouldExit(-1)
throw
}
Write-Output "Installed Consul."