Writing a locked variable resets TTL?

I was facing this behavior working with Nomad API (v1.7.5).

  • I acquire the lock on a variable using the var lock API setting a TTL of 120s.
  • The lock is correctly executed, I receive the lock ID and if I call a var get API, I see that the Lock block is correctly set with TTL=2m0s.
  • Then I update the variable, sending a JSON with the Items data and the lock section containing the lock ID, calling a var put API.
  • The variable Items section is correctly updated, but the TTL is reset to 15s (the default).

I tried with other combinations of TTL values, but the behavior still the same: the var put resets TTL to default.
My current workaround is to release and acquire again the lock at each update, but it could be a problem since the operation is not atomic.

Is it a bug, or shall I adopt another way to update the variable?