terraform-provider-docker icon indicating copy to clipboard operation
terraform-provider-docker copied to clipboard

Using devices always force replacement (it should not)

Open dubo-dubon-duponey opened this issue 3 years ago • 6 comments

In a shell:


      + devices { # forces replacement
          + host_path = "/dev/snd"
        }
      - devices { # forces replacement
          - container_path = "/dev/snd" -> null
          - host_path      = "/dev/snd" -> null
          - permissions    = "rwm" -> null
        }

dubo-dubon-duponey avatar Dec 03 '20 05:12 dubo-dubon-duponey

@suzuki-shunsuke @mavogel

I tried to fix this using DiffSuppressFunc, Default (https://www.terraform.io/docs/extend/schemas/schema-behaviors.html) but couldn't figure out a way (not sure why it's not working as other cases like working_dir).

Any pointer on how to approach this?

Desired behavior:

Permissions:

  • if permissions is empty or not set, it should be treated as if set to "rwm"
  • if permissions is set, it should be any combination of "r", "w", "m" (not repeated, case-sensitive), otherwise it's invalid
  • it should then be compared with the value in the running container, with the letters sorted to avoid rebuilding when the value is the same with a different order

ContainerPath:

  • if not set, it should be treated as if set to the value of host_path

dubo-dubon-duponey avatar Dec 04 '20 02:12 dubo-dubon-duponey

TBH I'm in general not happy with all the usage of DiffSuppressFunc and I think I need a feedback round with HC folks to understand how to implement those cases correctly

mavogel avatar Dec 25 '20 07:12 mavogel

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Mar 29 '21 10:03 github-actions[bot]

Still an issue - should be reopened.

dubo-dubon-duponey avatar Apr 06 '21 17:04 dubo-dubon-duponey

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Jun 06 '21 10:06 github-actions[bot]

Still an issue, bot ;-).

dubo-dubon-duponey avatar Jun 07 '21 22:06 dubo-dubon-duponey