Migration of iaas resources from openstack provider
Problem description
With the deprecation of the openstack API in STACKIT a lot of people might still use the openstack terraform provider to manage IaaS resources on STACKIT.
Terraform provides a moved block that can be used to move state from one resource to another. I would like to define my terraform resources with the new IaaS API resources and use a moved block to move the state from the Openstack resources to the new IaaS API ones.
Proposed solution
I would expect e.g. these resources to support such a migration
- openstack_compute_instance_v2 => stackit_server
- openstack_networking_network_v2 => stackit_network
- openstack_networking_port_v2 => stackit_network_interface
- openstack_networking_floatingip_v2 => stackit_public_ip
- openstack_networking_secgroup_v2 => stackit_security_group
- openstack_networking_secgroup_rule_v2 => stackit_security_group_rule
- openstack_blockstorage_volume_v3 => stackit_volume
resource "openstack_compute_instance_v2" "basic" {
name = "basic"
}
resource "stackit_server" "basic" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "basic"
}
moved {
from = openstack_compute_instance_v2.basic
to = stackit_server.basic
}
Additional information
The terraform-plugin-framework provides an interface on how to implement the move for such resources: https://developer.hashicorp.com/terraform/plugin/framework/resources/state-move
Since this is an already open issue it would be also great to have the same features like explained in https://github.com/stackitcloud/terraform-provider-stackit/pull/476. Currently there is no way to get the stackit_network from a data source by name. This is probably the case for other resources too. I could also create an additional Feature Request for that if its needed
Hi @hown3d, thank you for reporting this issue. We will have a look at it.