Search code examples
terraformopenstackterraform-provider-openstack

How to get the terraform state file of already created virtual machines in openstack


I would like to know if it is possible to use terraform or some other tool to obtain state files of already created virtual machines in openstack? I need this because I have a lot of virtual machines and they cannot be recreated because services run on them, but I would like to have descriptions of these machines in terrafrom.

I tried to find some solution, but didn't find anything suitable


Solution

  • you can use terraformer to import all resources at once.

    Example:

    terraformer import openstack --resources=compute,networking --regions=RegionOne
    

    List of supported OpenStack services:

    blockstorage:

    • openstack_blockstorage_volume_v1
    • openstack_blockstorage_volume_v2
    • openstack_blockstorage_volume_v3

    compute:

    • openstack_compute_instance_v2

    networking:

    • openstack_networking_secgroup_v2
    • openstack_networking_secgroup_rule_v2