awlsring / terraform-provider-headscale

A terraform provider for Headscale
https://registry.terraform.io/providers/awlsring/headscale/latest
Apache License 2.0
22 stars 2 forks source link

Omit destroy/expire if preauthkey was used #4

Closed oneingan closed 1 year ago

oneingan commented 1 year ago

Hi again, I recently found this problem when I rise up the expiration time.

The problem also exists upstream using CLI, but I'm not sure if it is a bug or if its expected. In anycase, maybe the provider could omit the destroy if the key was used and is not reusable.

headscale_pre_auth_key.controller: Destroying... [id=26]
╷
│ Error: Error deleting pre auth key
│ 
│ Could not expire key, unexpected error: [POST /api/v1/preauthkey/expire][500] HeadscaleService_ExpirePreAuthKey default  &{Code:2 Details:[] Message:AuthKey has
│ already been used}
╵
awlsring commented 1 year ago

This seems similar to #1 , I'll take a look at this soon and implement the same type of solution used for expired keys.