Skip to content

Instantly share code, notes, and snippets.

@HoussemDellai
Last active August 24, 2023 22:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HoussemDellai/3fa1cfeeac180479a0822674306cb2e0 to your computer and use it in GitHub Desktop.
Save HoussemDellai/3fa1cfeeac180479a0822674306cb2e0 to your computer and use it in GitHub Desktop.
Get Terraform providers versions in Powershell
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"
}
@HoussemDellai
Copy link
Author

created the gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment