- This repo is dedicated to
Set-TFVersion, the Terraform version changer for Windows - This simply sets the command
tfto use whichever version of Terraform you specify
- PowerShell
- See
Set-TFVersion.psm1for further details
- This module is best used in your PowerShell profiles
- You can find these under your
Documents\WindowsPowerShellfolder - In here, you should see
Microsoft.PowerShell_profile.ps1andMicrosoft.PowerShellISE_profile.ps1 - If you don't, create the
WindowsPowerShellfolder and create bothMicrosoft.PowerShell_profile.ps1andMicrosoft.PowerShellISE_profile.ps1 - Copy and paste the below into both
Microsoft.PowerShell_profile.ps1andMicrosoft.PowerShellISE_profile.ps1and modify accordingly to your environment
Write-Host -ForegroundColor Yellow "====================================="
Write-Host -ForegroundColor Yellow "Loading Custom PowerShell Environment"
Write-Host -ForegroundColor Yellow "====================================="
# Scripts directory
$Modules = "C:\Path\To\Modules\Folder"
# Load all modules
gci $Modules | % {Import-Module $Modules\$_}
Write-Host -ForegroundColor Green "====================================="
Write-Host -ForegroundColor Green "Custom PowerShell Environment Loaded"
Write-Host -ForegroundColor Green "====================================="
- Once you've done this, create a modules folder somewhere on your system as specified above in the
$Modulesvariable - Then drop
Set-TFVersion.psm1into your modules folder and open a new PowerShell window - Run
Set-TFVersionand hittabto confirm that the module is loaded - Select the version of Terraform that you want (if one is missing, edit the script and add it in)
- Use Terraform with
tfinstead ofterraform - Enjoy!