hashicorp / terraform-provider-docker

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/kreuzwerker/docker/latest
https://registry.terraform.io/providers/kreuzwerker/docker/latest
Mozilla Public License 2.0
132 stars 92 forks source link

Fix port objects with the same internal port but different protocol trigger recreation of container #274

Closed andrei-verdes closed 4 years ago

andrei-verdes commented 4 years ago

While comparing ports from the state with the new plan, it would sometimes compare 2 port objects with the same internal ports but different protocols, even though there is a port object with the same internal port and the same internal protocol, but it's just further down the list. And thus it would trigger a replacement.

Pretty consistent reproducing rate by adding these ports.

ports {
    internal = 8300
    external = 8300
    protocol = "tcp"
  }
  ports {
    internal = 8301
    external = 8301
    protocol = "tcp"
  }
  ports {
    internal = 8301
    external = 8301
    protocol = "udp"
  }
  ports {
    internal = 8302
    external = 8302
    protocol = "tcp"
  }
  ports {
    internal = 8302
    external = 8302
    protocol = "udp"
  }
  ports {
    internal = 8500
    external = 8500
    protocol = "tcp"
  }
  ports {
    internal = 8600
    external = 8600
    protocol = "tcp"
  }
  ports {
    internal = 8600
    external = 8600
    protocol = "udp"
  }