tailscale / terraform-provider-tailscale

Terraform provider for Tailscale
https://registry.terraform.io/providers/tailscale/tailscale
MIT License
255 stars 46 forks source link

Not able to retrieve the device #327

Closed jjsaunier closed 7 months ago

jjsaunier commented 7 months ago

I'm currently migrating some infra of dev workspace org using the tailscale terraform version 0.13.13 but I'm facing this issue

╷
│ Error: Could not find device with name dev-workspace-nat
│
│   with data.tailscale_device.dev_workspace_nat,
│   on dev-workspace.tf line 50, in data "tailscale_device" "dev_workspace_nat":
│   50: data "tailscale_device" "dev_workspace_nat" {
│

I'm unable to retrieve the device whereas it's correctly registered.

image

I'm retrieving the device via

data "tailscale_device" "dev_workspace_nat" {
    name = "dev-workspace-nat"
    wait_for = "60s"
}

Am I missing something or doing something wrong? I have followed the logic on the terraform doc https://registry.terraform.io/providers/tailscale/tailscale/latest/docs/resources/device_key

I'm interested to get your feedback, this is ruining my plans 😅

knyar commented 7 months ago

First step would probably be to use the same credentials you're passing to the Tailscale terraform provider to issue an list devices API call manually and check that you see the node there.

jjsaunier commented 7 months ago

Thanks for your insight

I can retrieve the machine; however the name is not the one I expected.

I got "name": "dev-workspace-nat.tail6efba.ts.net"

If I understand correctly, I should concat my machine name with .tail6efba.ts.net to get back to the actual name?

knyar commented 7 months ago

Yeah, it seems that the name should be an FQDN, just like the name in the example is.

jjsaunier commented 7 months ago

Yes, got it working thanks

To be honest the example is not super clear, in fact you know only if you know and make sense after you re read it. May be a little description like: name is formatted like <device-name>.<tailscale-domain> make it clearer

Anyway, thanks for your answers!