terraform/backend/remote-state/consul
Rémi Lapeyre 032d339915 Sanitize lock path for the Consul backend when it ends with a /
When the path ends with / (e.g. `path = "tfstate/"), the lock
path used will contain two consecutive slashes (e.g. `tfstate//.lock`) which
Consul does not accept.

This change the lock path so it is sanitized to `tfstate/.lock`.

If the user has two different Terraform project, one with `path = "tfstate"` and
the other with `path = "tfstate/"`, the paths for the locks will be the same
which will be confusing as locking one project will lock both. I wish it were
possible to forbid ending slashes altogether but doing so would require all
users currently having an ending slash in the path to manually move their
Terraform state and would be a poor user experience.

Closes https://github.com/hashicorp/terraform/issues/15747
2020-08-13 16:29:43 +02:00
..
backend.go add broken test for lock lost on connection error 2017-10-08 16:16:57 -04:00
backend_state.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
backend_test.go Sanitize lock path for the Consul backend when it ends with a / 2020-08-13 16:29:43 +02:00
client.go Sanitize lock path for the Consul backend when it ends with a / 2020-08-13 16:29:43 +02:00
client_test.go Sanitize lock path for the Consul backend when it ends with a / 2020-08-13 16:29:43 +02:00