mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-27 01:51:30 +02:00
GenerateSetupKey pins a one-off key at a single use and ignores whatever usage_limit the request asked for. A caller that asks for five gets a key that works once, is told the creation succeeded, and finds out only by using it. Terraform found this the hard way: the provider sends the usage limit it planned, the server stores a different one, the next refresh writes the server's value into state, and from then on every plan sees a change on an attribute that forces replacement. Adding a group to a one-off setup key destroyed the key and issued a new secret in its place. Values above 1 are now refused with a message naming the reusable type, which is what a caller asking for more than one use wants. 0 is still accepted: usage_limit is a required field with no null in it, so a caller with nothing to say about the limit has no way to say that except by sending 0, and refusing it would break every such client.