Prevent_destroy volumes for persistent data

following the lifecycle

I would like to prevent terraform from destroying my persistent data.

  on main.tf line 37:
  37: resource "openstack_blockstorage_volume_v2" "vol" {

Resource openstack_blockstorage_volume_v2.vol[0] has lifecycle.prevent_destroy
set, but the plan calls for this resource to be destroyed. To avoid this error
and continue with the plan, either disable lifecycle.prevent_destroy or reduce
the scope of the plan using the -target flag.

apparently the only way to workaround is to generate a list of targets to destroy ignoring the one where the lifecyle prevent_destroy was applied.

some issue reference:

some stack overflow references

any hint if there will be some automation possible for this reduce the scope of the plan using the -target

kind regards

1 Like