kreuzwerker / terraform-provider-docker

Terraform Docker provider
Mozilla Public License 2.0
570 stars 187 forks source link

Support for VolumeOptions.Subpath in docker_container.mounts.volume_options #612

Open pauliuspetk opened 2 months ago

pauliuspetk commented 2 months ago

Community Note

Description

Please add support for the new Subpath field in VolumeOptions added in Docker version 26.0.0.

It allows mounting a specific path within a volume to a target. Previously, it was only possible to mount the root of a volume to a target.

New or Affected Resource(s)

Potential Terraform Configuration

resource "docker_container" "postgres" {
  image = "postgres:latest"
  name = "postgres"
  mounts {
    type = "volume"
    source = docker_volume.volume.name
    target = "/var/lib/postgresql/data"
    volume_options {
      subpath = "some/path/pg_data"
    }
  }
}

References

https://github.com/moby/moby/pull/45687 https://github.com/moby/moby/commit/bfb810445c3c111478f5e0e6268ef334c38f38cf

andrewgosselin commented 1 month ago

I believe this renovate PR needs fixed and merged before this can happen since the Subpath changes were introduced in v26.1.2.

From looking at the build errors in that pull request it looks like the subpath changes introduced within the update is what's causing it to fail the build acceptance tests.

I do have a pull request in the works to add support but it hinges on getting that docker cli up to date. I may look into creating one myself to update it but its like 6 major versions behind, not sure if I have time for that. 😢