tailscale / terraform-provider-tailscale

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

Support import for all tailscale terraform resources #441

Closed reegnz closed 1 month ago

reegnz commented 1 month ago

Is your feature request related to a problem? Please describe. I'm managing my personal tailscale configuration with terraform. For ease of use it'd be preferable to support imports for the resources I am using, so I can get started configuring on the UI, then bring over the config to terraform and keep managing the resources. For that import would be preferable. Without imports there is no clear diff between the existing config and the desired one made in terraform.

Describe the solution you'd like

The resources I want to be able to import but lack import functionality:

Can be imported with any random id (only a single resource exists for it in the tailscale api):

tailscale_dns_nameservers
tailscale_dns_search_paths

Can be imported with an existing device id:

tailscale_device_key
tailscale_device_subnet_routes
tailscale_device_tags

IMHO allowing straight pass through id for the import is sufficient for all of the above resources.

Additional context There are likely some other resources that also lack import support right now.

reegnz commented 1 month ago

I have opened a PR for some of the resources. I did not add imports functionality for tailscale_tailnet_key, tailscale_posture_integration and tailscale_logstream_configuration because I am not using those features, and don't have an opportunity to test the changes.