Last active
August 24, 2023 22:41
-
-
Save HoussemDellai/3fa1cfeeac180479a0822674306cb2e0 to your computer and use it in GitHub Desktop.
Get Terraform providers versions in Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ForEach($provider in [array]@("terraform", "azurerm", "azuread", "http", "time", "helm", "kubernetes", "azapi")) | |
{ | |
if ($provider -eq "terraform") | |
{ | |
$endpoint=$("https://api.github.com/repos/hashicorp/terraform/releases/latest") | |
} | |
elseif ($provider -eq "azapi") | |
{ | |
$endpoint=$("https://api.github.com/repos/Azure/terraform-provider-$provider/releases/latest") | |
} | |
else | |
{ | |
$endpoint=$("https://api.github.com/repos/hashicorp/terraform-provider-$provider/releases/latest") | |
} | |
$version=($(curl $endpoint).Content | ConvertFrom-Json).name | |
echo "$provider $version" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
created the gist