Download the latest Hashicorp Terraform, Packer, and Vault bits

I created a PowerShell Script that downloads the latest version of Terraform, Packer, and Vault, extracts the archives to binaries, and adds the folder of the path environment variable. Running this script ensures you always work with the latest versions of Terraform, Packer, and Vault.

<#
    .DESCRIPTION Function to download and extract the latest Packer, Terraform and Vault version from Hashicorp
    .NOTES Author:  Ivo Beerens
    .NOTES Site:    www.ivobeerens.nl
    .NOTES Version: 1.0
    .NOTES Changed: September 10, 2023 
    .NOTES Reason:  Creation
#>

#Enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#Speed up the Invoke-Webrequest command
$ProgressPreference = 'SilentlyContinue'

#Variables
$temp_folder = "c:\install\" #Temp download location 
$hashicorp_destination = "c:\install\hashicorp\" #Path for storing the Hashicorp binaries

#Check if the temp folder exists
If(!(test-path -PathType container $hashicorp_destination )) {
    New-Item -ItemType Directory -Path $hashicorp_destination 
}

#Jump to the download folder
Set-Location $hashicorp_destination 

Function Download-Hashicorp {
    param (
      [string]$product,
      [string]$url
     )
     try {
        Write-Host "............ Download $product from Hashicorp ............" -ForegroundColor Green
        $urls = Invoke-WebRequest -Uri $url| Select-Object -Expand links | Where-Object href -match "//releases\.hashicorp\.com/$product/\d.*/$product_.*_windows_amd64\.zip$" | Select-Object -Expand href
        $filename = $urls | Split-Path -Leaf
        $download = $temp_folder + $filename
        #Download Hashicorp bits
        Invoke-WebRequest $urls -outfile $download
        #Expand archive
        Write-Host "............ Expand $product archive to binary ............" -ForegroundColor Yellow
        Expand-Archive $download -DestinationPath $hashicorp_destination -Force
        Write-Host "............ Remove $product archive download............" -ForegroundColor Blue
        #Remove download
        Remove-Item $download
     }
     catch {
        Write-Host "An error occurred while downloading or extracting $product" -ForegroundColor Red
        throw $_.Exception.Message
     } 
  }

#Download Packer, Vault, and Terraform 
$products = @{
    'packer' = 'https://developer.hashicorp.com/packer/downloads'
    'vault' = 'https://developer.hashicorp.com/vault/downloads'
    'terraform' = 'https://developer.hashicorp.com/terraform/downloads'
}

foreach ($product in $products.GetEnumerator()) {
    Download-Hashicorp -product $product.Name -url $product.Value
}

##Add the Hashicorp binary folder to the system environment variable path
Write-Host "............ Add folder to path ............" -ForegroundColor Green
[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";" + $hashicorp_destination, [EnvironmentVariableTarget]::User)
Write-Host "Please restart your PowerShell session for the changes to take effect." -ForegroundColor Yellow

Line 15: Change the temp folder for storing the downloaded archive files
Line 16: Change the folder path for storing the Hashicorp binaries for Terraform, Packer, and Vault
Line 19-22: Check if the folder for storing the Hashicorp binaries for Terraform, Packer, and Vault exists. If not it will be created
Line 24-50: Function that downloads and extracts the archive files for Terraform, Packer, and Vault
Line 52-61: Run the function to download and extract the Hashicorp Terraform, Packer, and Vault
Line 63-66: adds the folder of the Hashicorp binaries to the path environment variable

The latest version of this script can be found on my GitHub page, Link.

 

The latest technology news Week 37-2023

Welcome to our weekly roundup of the hottest tech updates in the worlds of Azure, VMware, and other partners. In this series, we’ll be curating a collection of must-read articles, each offering a deep dive into the latest technological advancements, news, and trends within these cutting-edge platforms.

We understand that in today’s fast-paced tech landscape, staying informed is key. That’s why we’re here to make it easy for you. Each week, we’ll handpick the most insightful and informative articles that cover everything from Cloud, virtualization, Infrastructure As Code (IaC), DevOps to End User Computing breakthroughs.

Without further ado, let’s dive into this week’s top tech insights:

Microsoft Azure

  • Choose an Azure compute service. Link
  • Announcing the general availability of new Azure burstable virtual machines. Link
  • Migration and modernization for Oracle workloads. Link
  • Entra News #10: Your weekly dose of Microsoft Entra. Link
  • Performance Testing with Azure Firewall Basic SK. Link
  • David-Summers/Azure-Design: My Azure stencil collection for Visio. Highly functional and always up to date. Link
  • PIM, PAM and PAW – what and how in Azure? Link
  • Supported Kubernetes versions in Azure Kubernetes Service (AKS). Link
  • Get Ahead with Self-Hosted Agents and Container Apps Jobs. Link

Azure Virtual Desktop (AVD) / Windows 365 / VMware Horizon / EUC

  • Windows 365 Enterprise – Points of Clarification and PoC Proven Practices. Link
  • AVD Automation Cocktail – Azure Virtual Desktop automated with Bicep and Azure CLI. Link
  • AVD Community Newsletter – 14th September 2023. Link
  • Week 37-2023 VMware Enduser Computing Updates. Link
  • Ruben’s EUC Industry Bento Box – September 2023. Link
  • FSLogix App Masking YouTube video. Link
  • Deploy secure management and monitoring to Azure Virtual Desktop. Link

Intune

  • Easily removing access to the Microsoft Store. Link
  • Send Intune Discovered apps to Log Analytics with Azure Automation. Link
  • Intune: Auto Reconnect Mapped Drives. Link
  • Windows Autopilot Testing in VMs: A Step-by-Step Guide! Link
  • Intune Newsletter – 15th September 2023. Link
  • Endpoint Management Community Newsletter – September 11-17, 2023. Link
  • Deploy SentinelOne with Intune. Link

Infrastructure as Code (IaC) / DevOps

  • Gitops Your Scheduled Tasks. Link
  • Introduction to Azure DevOps Workload Identity Federation (OIDC) with Terraform. Link
  • Azure Deployment using Terraform Cloud – Overview, Prerequisites, Sample Code, and Resources. Link
  • A simple example of Windows PowerShell Just Enough Administration (JEA)! Link
  • Connect to Microsoft Graph in Azure DevOps Pipelines using Workload Identity Federation. Link
  • Streamlining Multi-Component Deployments to Terraform Environments with GitHub Actions Matrices. Link
  • Best Practices: 7 Key Benefits of Automated Infrastructure Deployment. Link
  • Terraform Cloud pricing. Link
  • Build image with containerized self-hosted Azure DevOps agent and private Azure Container Registry. Link

Microsoft Defender

  • Common mistakes during Microsoft Defender for Endpoint deployments. Link

Vembu

  • BDRSuite now offers agentless backup and recovery for KVM virtual machines, seamlessly integrated with KVM hypervisor. Link

VMware

  • Bulk Deploy UAGs. Link
  • Extreme Performance Series 2023: Optimizing for Latency Sensitive Applications. Link

Windows

  • End of servicing plan for third-party printer drivers on Windows. Link
  • Release notes: September 2023 – Windows 11, version 22H2. Link
  • Windows 11 KB5030219 trashes PCs, gaming performance issues affect Starfield. Link

Searching for VMware resources?

Here’s an overview of VMware resources I frequently use.

VMware Downloads

Name Description Link
VMware Product Downloads All VMware product downloads. https://customerconnect.vmware.com/en/downloads/#all_products
VMware Patches VMware patches https://customerconnect.vmware.com/patch/
VMware Trials VMware Trials product downloads such as the https://www.vmware.com/trials-test-drives.html
VMware Tools releases All VMware tools release https://packages.vmware.com/tools/releases/
VMware Flings Unofficial apps built by VMware employees to enhance VMware products https://flings.vmware.com/

Technical Reference

Name Description Link
VMware Knowledge Base Knowledge Base https://kb.vmware.com/
VMware Support Insider The top support articles https://blogs.vmware.com/kb/
Product Documentation VMware Product documentation https://docs.vmware.com/
Tech Zone Go from zero to hero with the latest technical resources on the VMware Digital Workspace Tech Zone https://techzone.vmware.com/
Technical Papers All published technical papers in PDF format https://www.vmware.com/techpapers.html
VMware Blogs VMware blogs https://blogs.vmware.com/
Community Forums Community Forums https://communities.vmware.com/
VMware ports Discover which ports are required by VMware products https://ports.esp.vmware.com/
VMware Developer Integrate with VMware APIs to build on top of VMware products, manage our portfolio and automate your infrastructure. https://developer.vmware.com/home
VMware GitHub VMware GitHub page https://github.com/vmware/

Compatibility checks

Name Description Link
Compatibility Guides VMware Hardware Compatability Guides (HCL) https://www.vmware.com/resources/compatibility/search.php
Interoperability matrix Product Interoperability matrix https://interopmatrix.vmware.com/Interoperability

Learning

Name Description Link
VMware Learning VMware learning site https://www.vmware.com/learning.html
VMware Hands-on Learning & Trials VMware Hands-on Learning & Trials https://www.vmware.com/trials-test-drives.html

Security

Name Description Link
VMware Security Advisories VMware Security Advisories document remediation for security vulnerabilities that are reported in VMware products. https://www.vmware.com/security/advisories.html
VMware Security Hardening Guides Security Hardening Guides provide prescriptive guidance for customers on how to deploy and operate VMware products in a secure manner. https://www.vmware.com/security/hardening-guides.html

If you have other VMware resources let me know!