Skip to content

Commit f98ebaf

Browse files
feat: support azurerm v4 (#278)
# Pull Request ## Description azurerm v4 requires ARM_SUBSCRIPTION_ID env var to be set ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent d70001f commit f98ebaf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ALZ/Private/Deploy-Accelerator-Helpers/Invoke-Terraform.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ function Invoke-Terraform {
2424
)
2525

2626
if ($PSCmdlet.ShouldProcess("Apply Terraform", "modify")) {
27+
# Check and Set Subscription ID
28+
if($null -eq $env:ARM_SUBSCRIPTION_ID -or $env:ARM_SUBSCRIPTION_ID -eq "") {
29+
Write-Verbose "Setting environment variable ARM_SUBSCRIPTION_ID"
30+
$subscriptionId = $(az account show --query id -o tsv)
31+
if($null -eq $subscriptionId -or $subscriptionId -eq "") {
32+
Write-Error "Subscription ID not found. Please ensure you are logged in to Azure and have selected a subscription. Use 'az account show' to check."
33+
return
34+
}
35+
$env:ARM_SUBSCRIPTION_ID = $subscriptionId
36+
Write-Verbose "Environment variable ARM_SUBSCRIPTION_ID set to $subscriptionId"
37+
}
38+
2739
terraform -chdir="$moduleFolderPath" init
2840
$action = "apply"
2941
if($destroy) {

0 commit comments

Comments
 (0)