Terragrunt Windows string path buliding mixing backslashes and forward slashes
Describe the bug
When using Windows, path-string building uses backslash for all operations, including the case of fetching the remote backend Terraform states for Terragrunt units.
I'm using Azure Storage Account for storing the remote backend for all units and the constructed URL for calling it is set as following mixing the backslashes and forward slashes:
https://<storage-account-name>.blob.core.windows.net/<container>/path\to\\\unit/terraform.tfstate
This gives the following error:
ERROR [.] terraform.exe: Error: Error loading state: building request: building GET request: parse "https://<storage-account-name>.blob.core.windows.net/<container>/<path>\<to>\<unit>/terraform.tfstate": net/url: invalid control character in URLThis behaviour doesn't happen on previous Terragrunt versions, for example, 0.99.4 which works with the same Terraform version 1.14.6 without issue
Steps To Reproduce
Example of the given unit where it is in a Windows path live\\\unit\this\terragrunt.hcl that has a dependency the live\another_unit\this\terragrunt.hcl
live\\\unit\this\terragrunt.hcl
terraform {
source = "git::<sample-repo>//path/to/module?ref=<git-ref>"
}
dependencies {
paths = [
"../../another_unit/this"
]
}
dependency "another_unit" {
config_path = "../../another_unit/this"
mock_outputs = {
id = "xxxx"
}
}
inputs = { }live\another_unit\this\terragrunt.hcl
terraform {
source = "git::<sample-repo>//path/to/other-module?ref=<git-ref>"
}
inputs = { }Expected behavior
All path strings should be converted to use forward slashes when calling remote backends and all non-local filesystem operations. So it should finally resolve the path to:
https://<storage-account-name>.blob.core.windows.net/<container>/path/to/unit/terraform.tfstate
Versions
- Terragrunt version: 1.1.3
- OpenTofu/Terraform version: 1.14.6
- Environment details (Ubuntu 20.04, Windows 10, etc.): Windows 11
Additional context
This behaviour doesn't happen on previous Terragrunt versions, for example, 0.99.4 which works with the same Terraform version 1.14.6 without issue
Source: gruntwork-io/terragrunt