plumber-cd / terraform-backend-git

Terraform HTTP Backend implementation that uses Git repository as storage
Apache License 2.0
185 stars 18 forks source link

Incorrect state file URL on Windows #40

Closed Hathoute closed 9 months ago

Hathoute commented 9 months ago

The generated state URL contains backslashes on windows due to filepath.Clean being applied on the state parameter. An example would be:

[terraform-backend-git]: Locking state in https://github.com/Hathoute/terraform-states?ref=main//common\v1\state.json
[terraform-backend-git]: command error on refs/heads/locks/common\v1\state.json: funny refname

A fix would be to probably drop the Clean method since it doesn't do much anyway (we have to provide the full path to the state file).

dee-kryvenko commented 9 months ago

Hey @Hathoute - thank you for interest in this project. You are right, looks like I incorrectly used filepath instead of path for sanitizing user input. I just pushed the fix - will build a release shortly.