Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libvirt_pool path => target.path migration (0.8.x) without destroying pool? #1127

Open
alexs77 opened this issue Nov 7, 2024 · 0 comments
Open

Comments

@alexs77
Copy link

alexs77 commented Nov 7, 2024

I've updated the libvirt provider from 0.7.6 to 0.8.1. Doing so, I noticed that the attribute path of libvirt_pool is now deprecated.

The documentation also shows that:

  • path - Deprecated (Optional) use path in the target block.

I then changed the source code to this:

resource "libvirt_pool" "this" {
  name = local.name
  type = "dir"

  target {
    path = join("/", [var.images_directory, local.name])
  }
}

Before that, it was:

resource "libvirt_pool" "this" {
  name = local.name
  type = "dir"
  path = join("/", [var.images_directory, local.name])
}

When I then ran terraform plan, I saw that it would destroy and recreate the pool:

-/+ resource "libvirt_pool" "this" {
      ~ allocation = 172974288896 -> (known after apply)
      ~ available  = 5322446831616 -> (known after apply)
      ~ capacity   = 5495421120512 -> (known after apply)
      ~ id         = "bb50964a-48c8-4e1e-ada5-e000e7f29d27" -> (known after apply)
        name       = "vtcl-qatestvm-zbl-110.domain.tld"
      - path       = "/var/lib/libvirt/images/vtcl-qatestvm-zbl-110.domain.tld" -> null # forces replacement
        # (1 unchanged attribute hidden)
      + target {
          + path = "/var/lib/libvirt/images/vtcl-qatestvm-zbl-110.domain.tld" # forces replacement
        }
    }

This change cannot be performed, though. terraform apply fails:

…
│ Error: error deleting storage pool: failed to remove pool '/var/lib/libvirt/images/vtcl-qatestvm-zbl-110.domain.tld': Directory not empty
…

How to migrate to the new structure of libvirt_pool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant