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

Failing when supplying empty block storage for zfs #432

Open
jseravalli opened this issue Feb 17, 2024 · 2 comments · May be fixed by #467
Open

Failing when supplying empty block storage for zfs #432

jseravalli opened this issue Feb 17, 2024 · 2 comments · May be fixed by #467
Labels

Comments

@jseravalli
Copy link

Hi! :) I'm setting up a local lxd with a storage pool off a secondary drive in /dev/sbd1 but when I'm trying to create the pool I get the following error:

lxd_storage_pool.data1: Creating...
lxd_storage_pool.data1: Still creating... [10s elapsed]
lxd_storage_pool.data1: Still creating... [20s elapsed]
lxd_storage_pool.data1: Still creating... [30s elapsed]
lxd_storage_pool.data1: Still creating... [40s elapsed]
lxd_storage_pool.data1: Still creating... [50s elapsed]
lxd_storage_pool.data1: Still creating... [1m0s elapsed]
lxd_storage_pool.data1: Still creating... [1m10s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to lxd_storage_pool.data1, provider
│ "provider[\"registry.terraform.io/terraform-lxd/lxd\"]" produced an
│ unexpected new value: .config["source"]: was cty.StringVal("/dev/sdb1"),
│ but now cty.StringVal("data1").
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

make: *** [apply] Error 1

My terraform looks like:

resource "lxd_storage_pool" "data1" {
  name   = "data1"
  driver = "zfs"

  config = {
    "source" = "/dev/sdb1" 
  }
}

It kinda makes sense since the lxd pool is created like so:

$ lxc storage list
+-------+--------+--------+-------------+---------+---------+
| NAME  | DRIVER | SOURCE | DESCRIPTION | USED BY |  STATE  |
+-------+--------+--------+-------------+---------+---------+
| data1 | zfs    | data1  |             | 3       | CREATED |
+-------+--------+--------+-------------+---------+---------+

my workaround is that I untaint the resource and then I modify the config to match lxc:

resource "lxd_storage_pool" "data1" {
  name   = "data1"
  driver = "zfs"

  config = {
    "source" = "data1" 
  }
}

And it works, but I figure a report wouldn't hurt

@MusicDin
Copy link
Member

MusicDin commented Feb 26, 2024

Hi, thanks for reporting this issue (and sorry for late response).

From the above error we can see that Terraform is applying the correct value (/dev/sdb1), but LXD changes it to the zpool name (data1) which produces an inconsistent result (the result does not equal the initial plan). Seems that we will have to add some exceptions when parsing pool's source.

@MusicDin MusicDin added the bug label Feb 26, 2024
@jseravalli
Copy link
Author

No worries, actually sorry for my late response too 😅

point me in the right direction and I think I should be able to throw a PR fixing it

@MusicDin MusicDin linked a pull request May 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants