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

Support for Docker Cluster Volumes #619

Open
StoneMonarch opened this issue May 20, 2024 · 1 comment
Open

Support for Docker Cluster Volumes #619

StoneMonarch opened this issue May 20, 2024 · 1 comment

Comments

@StoneMonarch
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Support for all possible options in the docker cli command docker volume create allowing for Cluster Volumes to be created.

The current implementation only creates a volume on the node that terraform connects to, causing issues when the service and volume are on differant nodes.

The current workaround for this is to create each volume everytime it is needed in the docker_service resource.

New or Affected Resource(s)

  • docker_volume

Potential Terraform Configuration

resource "docker_volume" "test" {
  name = "test"
  driver_opts = {
    type   = "nfs"
    o      = "addr=test.server,rw"
    device = ":/mnt/Puddle/test"
  }
  scope  = "multi"
  sharing = "all"
  # All other `docker volume create` options
}

References

@dantedevenir
Copy link

dantedevenir commented Jul 13, 2024

/* 
The Problem:
 resource "docker_volume" "tmp_volume" {
  	name = "tmp_volume"
	driver_opts = {
		"type" = "none"
		"device" = "${path.cwd}/_bindfolder"
		"o" = "bind"
	}
} */
 //Ugly Solution:
resource "null_resource" "set_volume_permissions" {
	provisioner "local-exec" {
		command = <<-EOT
			docker volume create \
				--name tmp_volume \
				--opt type=none \
				--opt device=${path.cwd}/_bindfolder \
				--opt o=bind
		EOT
	}
}

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

2 participants