1

I have a Terraform Cloud account connected to a git repo (a VCS-backed workspace), so I can only do VCS-driven run workflows. I have a VM with an attached volume and I would like to recreate the volume from scratch (yes, losing all data). I have read about plan replace option, but this can not be used in my workspace.

So, which is the best option to perform a volume re-creation with a Terraform VCS-backed workspace?

By the way I'm using an OpenStack as cloud infrastructure and official terraform-provider-openstack/openstack provider.

logoff
  • 3,347
  • 5
  • 41
  • 58
  • If you are forced into a VCS workspace, then you probably will have to manually remove the attached volume. The provider should recognize the removal during the state refresh (if it has a decent `read` function for the resource), and it will create a replacement. – Matthew Schuchard Nov 05 '21 at 12:27
  • @MattSchuchard so, do you propose detaching a volume and then attaching a new one? but I guess this will attach the same one. my guess is doing it in 2 steps, which I don't like... – logoff Nov 05 '21 at 15:08
  • No, I would recommend my comment above. I would also more recommend using a CLI or API driven workflow instead so that you can do this in a pipeline, and also improve robustness and integrations, but that would be a larger effort. – Matthew Schuchard Nov 05 '21 at 16:19
  • @MattSchuchard may you post an answer with more detail about your first comment? I don't understand how can I detach the volume and attach a new one. thanks! – logoff Nov 06 '21 at 18:11

0 Answers0