Skip to content

Bug: chdir error if tilde (~) is in module path #389

Open
@richeney

Description

@richeney

Is there an existing issue for this?

  • I have searched the existing issues

Infrastructure as Code Type? (Required)

terraform

PowerShell Module Version (Optional)

No response

Bootstrap Module Version (Optional)

No response

Starter Module? (Required)

terraform - platform_landing_zone

Starter Module Version (Optional)

No response

Input arguments of the ALZ-PowerShell-Module (Optional)

No response

Debug Output/Panic Output (Optional)

Running in PowerShell 7.5.0 in WSL Ubuntu 24.04 on Windows ARM64.

PS /home/richeney/accelerator> Deploy-Accelerator `
>> -inputs "~/accelerator/config/inputs.yaml", "~/accelerator/config/platform-landing-zone.tfvars" `
>> -starterAdditionalFiles "~/accelerator/config/lib" `
>> -output "~/accelerator/output"
Checking the software requirements for the Accelerator...

Check Result Check Details
------------ -------------
Success      PowerShell version 7.5.0 is supported.
Success      Git is installed.
Warning      At least one environment variable is set, but the other expected environment variables are not set. This could cause Terraform to fail in unexpected ways. Set environment variables: ARM_SUBSCRIPTION_ID (a7484f13-d60f-4e5a-a530-fdaade387
             16a).
Success      Azure CLI is installed.
Success      Azure CLI is logged in. Tenant ID: ac40fc60-2717-4051-a567-c0cd948f0ac9, Subscription: Richard Cheney - Platform - Management (a7484f13-d60f-4e5a-a530-fdaade38716a)
Success      ALZ module is the latest version (4.2.11).


Getting ready to deploy the accelerator with you...

Checking you have the latest version of Terraform installed...

Checking and Downloading the bootstrap module...
The directory for /home/richeney/accelerator/output/bootstrap/v4.7.4 has been created and populated.
Error handling -chdir option: chdir ~/accelerator/output/.tools/azure-regions: no such file or directory
Error handling -chdir option: chdir ~/accelerator/output/.tools/azure-regions: no such file or directory

Terraform plan for apply failed with exit code 1. Please review the error and try again or raise an issue.
Exception: /home/richeney/.local/share/powershell/Modules/ALZ/4.2.11/Private/Deploy-Accelerator-Helpers/Invoke-Terraform.ps1:89
Line |
  89 |              throw "Terraform plan failed with exit code $exitCode. Pl …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Terraform plan failed with exit code 1. Please review the error and try again or raise an issue.

Expected Behaviour (Required)

Actual Behaviour (Required)

Expand ~ in moduleFolderPath with $env:HOME to avoid chdir errors in Terraform whilst running the bootstrap.

Steps to Reproduce (Optional)

No response

Important Factoids (Optional)

No response

References (Optional)

I'll create a PR and reference this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions