Hi, I just tried <Tailscale providers TailnetKey r...
# getting-started
c
Hi, I just tried Tailscale providers TailnetKey resource. Point of this resource is to generate key, with which new machine can register to Tailscale VPN. All works nice: I pass that key to AWS EC2 instance CloudInit and machine registers. By register I mean there is entry created in Tailscale interface with registered machines. Now, when I delete stack all gets removed but that entry in Tailscale list of machines remains. And that is understandable as Pulumi didn’t manage that record. And there is no “Machine” or “Device” resource defined in provider. But there is getDevice function. With that function I could get that device identifiers and using Tailscale API I could just delete that resource on, say, EC2 instance removal. And here goes my question: how to register a hook on
before destroy
of resource or something like that? (please, point me to channel I should use if this is wrong place to ask that general question)
b
@careful-twilight-32656 make the device ephemeral, it’ll drop out of the devices list once it disconnects https://tailscale.com/kb/1111/ephemeral-nodes
c
Yeah, but let’s say that machine goes offline for some time due to failure. Let’s imagine it failed Friday afternoon and I’ll bring it back Monday morning. Ephemeral machine approach will cause more problems. My general question is if there is Pulumi hooks mechanism?
b
Ephemeral machine approach will cause more problems
no, it won’t. there are better ways to solve this problem, but will leave that to you
c
As far as I can see Tailscale documentation says that ephemeral machine can stay offline 30 minutes to 48 hours and not be removed. I know that scenario with 3 days of downtime failure is unrealistic but: 1. 30m - 48h is pretty wide so I was thinking how to handle if downtime is 1h (which is more possible) and tailscale already removed machine from network. 2. my general question (is there a way to add hook on resource action?) stays because of multiple operations you want to perform on resource action