github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/terraform/packer/windows/install-vault.ps1 (about)

     1  Set-StrictMode -Version latest
     2  $ErrorActionPreference = "Stop"
     3  
     4  # Force TLS1.2
     5  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
     6  
     7  Set-Location C:\opt
     8  
     9  Try {
    10      $releases = "https://releases.hashicorp.com"
    11      $version = "1.2.3"
    12      $url = "${releases}/vault/${version}/vault_${version}_windows_amd64.zip"
    13  
    14      $configDir = "C:\opt\vault.d"
    15      md $configDir
    16  
    17      # TODO: check sha!
    18      Write-Output "Downloading Vault from: $url"
    19      Invoke-WebRequest -Uri $url -Outfile vault.zip
    20      Expand-Archive .\vault.zip .\
    21      mv vault.exe C:\opt\vault.exe
    22      C:\opt\vault.exe version
    23      rm vault.zip
    24  
    25  } Catch {
    26      Write-Error "Failed to install Vault."
    27      $host.SetShouldExit(-1)
    28      throw
    29  }
    30  
    31  Write-Output "Installed Vault."