terraform-provider-docker/testdata/resources/docker_service/testAccDockerServiceMounts.tf
Manuel Vogel 7f96a26866
fix/service bind options (#234)
* fix: give service bind_options propagation rprivate as default
* test: add second bind mount for full-service spec to test this case as well
* docs: add a second mount to service example
* fix(service): allow other options for mount binds although they might not be the specified type
* test: for empty and null mount bind
* docs(service): explains propagation more in details
* docs(service): adds missing default for propagation
* fix(test): update stop grace period to 30s for flaky test on gh actions

Co-authored-by: Shunsuke Suzuki <suzuki-shunsuke@users.noreply.github.com>
2021-06-27 16:34:01 +02:00

48 lines
1.1 KiB
HCL

provider "docker" {
registry_auth {
address = "127.0.0.1:15000"
}
}
resource "docker_volume" "test_volume" {
name = "tftest-volume"
}
resource "docker_service" "foo_empty" {
name = "tftest-service-mount-bind-empty"
task_spec {
container_spec {
image = "127.0.0.1:15000/tftest-service:v1@sha256:2ca4c7a50df3515ea96106caab374759879830f6e4d6b400cee064e2e8db08c0"
stop_grace_period = "10s"
mounts {
target = "/mount/test"
source = docker_volume.test_volume.name
type = "bind"
read_only = true
bind_options {}
}
}
}
}
resource "docker_service" "foo_null" {
name = "tftest-service-mount-bind-null"
task_spec {
container_spec {
image = "127.0.0.1:15000/tftest-service:v1@sha256:2ca4c7a50df3515ea96106caab374759879830f6e4d6b400cee064e2e8db08c0"
stop_grace_period = "10s"
mounts {
target = "/mount/test"
source = docker_volume.test_volume.name
type = "bind"
read_only = true
bind_options {
propagation = null
}
}
}
}
}