terraform-provider-hcloud icon indicating copy to clipboard operation
terraform-provider-hcloud copied to clipboard

[Feature]: Migrate to TF Plugin Framework

Open apricote opened this issue 9 months ago • 1 comments

What whould you like to see?

Terraform has launched a new "Plugin Framework" that replaces the Plugin SDK v2. This new framework supports some advanced scenarios that currently do not work properly. It can help us solve a number of bugs that we are experiencing:

  • SDK v2 only supports "int" while Plugin Framework supports explicit "int64" types (Related to hcloud-go v2)
  • Plugin Framework supports strongly typed access to fields, which will help with a number of issues I discovered while trying to migrate to hcloud-go v2
  • Terraform 1.4 introduced a bug for nested sets with computed fields (https://github.com/hetznercloud/terraform-provider-hcloud/issues/650). This would be fixed by switching to Plugin Framework
  • Plugin Framework has a number of util functions regarding Diagnostics (https://github.com/hetznercloud/terraform-provider-hcloud/issues/692) that make them easier to use.
  • SDK v2 only supports binary ForceNew for schema attributes. For hcloud_server.server_type it makes sense to ForceNew when switching between x86 and Arm, but to keep the same server and scale it in case the architecture stays the same. This is supported by the Plugin Framework. See #853

This migration will be a huge refactoring effort. We plan on doing it in many smaller steps, migrating a couple of resources at a time.

  • [x] #749
  • [ ] Migrate individual resources/datasources
    • [ ] Certificates
      • [ ] hcloud_certificate
      • [ ] hcloud_uploaded_certificate
      • [ ] hcloud_managed_certificate
      • [ ] data.hcloud_certificate
      • [ ] data.hcloud_certificates
    • [x] Datacenter
      • [x] data.hcloud_datacenter #779
      • [x] data.hcloud_datacenters #779
    • [ ] Firewall
      • [ ] hcloud_firewall
      • [ ] hcloud_firewall_attachment
      • [ ] data.hcloud_firewall
      • [ ] data.hcloud_firewalls
    • [ ] Floating IPs
      • [ ] hcloud_floating_ip
      • [ ] hcloud_floating_ip_assignment
      • [ ] data.hcloud_floating_ip
      • [ ] data.hcloud_floating_ips
    • [ ] Image
      • [ ] data.hcloud_image
      • [ ] data.hcloud_images
    • [ ] Load Balancer
      • [ ] hcloud_load_balancer
      • [ ] hcloud_load_balancer_network
      • [ ] hcloud_load_balancer_service
      • [ ] hcloud_load_balancer_target
      • [ ] data.hcloud_load_balancer
      • [ ] data.hcloud_load_balancers
    • [x] Location
      • [x] data.hcloud_location https://github.com/hetznercloud/terraform-provider-hcloud/pull/796
      • [x] data.hcloud_locations https://github.com/hetznercloud/terraform-provider-hcloud/pull/796
    • [ ] Network
      • [ ] hcloud_network
      • [ ] hcloud_network_subnet
      • [ ] hcloud_network_route
      • [ ] data.hcloud_network
      • [ ] data.hcloud_networks
    • [ ] Placement Group
      • [ ] hcloud_placement_group
      • [ ] data.hcloud_placement_group
      • [ ] data.hcloud_placement_groups
    • [ ] Primary IP
      • [ ] hcloud_primary_ip
      • [ ] data.hcloud_primary_ip
      • [ ] data.hcloud_primary_ips
    • [ ] RDNS
      • [ ] hcloud_rdns
    • [ ] Server
      • [ ] hcloud_server
      • [ ] hcloud_server_network
      • [ ] data.hcloud_server
      • [ ] data.hcloud_servers
    • [ ] Server Type
      • [ ] data.hcloud_server_type
      • [ ] data.hcloud_server_types
    • [ ] Snapshot
      • [ ] hcloud_snapshot
    • [x] SSH Key
      • [x] hcloud_ssh_key #817
      • [x] data.hcloud_ssh_key #817
      • [x] data.hcloud_ssh_keys #817
    • [ ] Volume
      • [ ] hcloud_volume
      • [ ] hcloud_volume_attachment
      • [ ] data.hcloud_volume
      • [ ] data.hcloud_volumes
  • [ ] Clean up remaining SDK v2 usages
  • [ ] Clean up old provider & muxing

apricote avatar Sep 15 '23 05:09 apricote