dariusbakunas / terraform-provider-truenas

Experimental terraform provider to manage TrueNAS server
MIT License
72 stars 17 forks source link

How to use resource truenas_dataset for nested DS were levels > 2 #23

Open nrvale0 opened 7 months ago

nrvale0 commented 7 months ago

Howdy. Curious if you can provide an example of how one might specify DataSet nesting > 2 using the truenas_dataset resource?

This works great for <= 2:

resource "truenas_dataset" "Sync" {
  pool = "<redacted>"
  name = "Sync"
  compression = "off"
  sync = "inherit"
  atime = "off"
  deduplication = "off"
  readonly = "off"
}

resource "truenas_dataset" "Media" {
  pool = "<redacted>"
  parent = "Sync"
  name = "Media"
  compression = "off"
  sync = "inherit"
  atime = "off"
  deduplication = "off"
  readonly = "off"
  depends_on = [
    truenas_dataset.Sync
  ]
}

However, things get a little less clear once you do deeper. For example: //Sync/Media/Movies:

resource "truenas_dataset" "Movies" {
  pool = "<redacted>"
  parent = "Media" # <- What should go here? ex: '/<pool>/Sync'?
  name = "Movies"
  compression = "off"
  sync = "inherit"
  atime = "off"
  deduplication = "off"
  readonly = "off"
  depends_on = [
    truenas_dataset.Media # <- What about here?
  ]
}

Thanks for any insight you can share.