Open mavogel opened 3 years ago
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
.
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
.
We are currently reading the ports data from the container.NetworkSettings.Ports
, which is {}
when the container has exited.
However, we can get the full port information from HostConfig.PortBindings
, but we still have a problem:
The ports
attribute of the docker_container
resource is of type TypeList
, which is a "ordered collection of items". We cannot map the order between the ports
and the data from HostConfig.PortBindings
That could be solved, though, by changing the type of ports
to TypeSet
("unordered collection of items").
This change is also mentioned inside https://github.com/kreuzwerker/terraform-provider-docker/issues/88
And the nice thing is: This is not a breaking change, because an ordered list is actually a subtype of an unordered list, so this should not create an issues when upgrading.
Hence, the next step is to change the ports
type, then we can fix this issue
This issue was originally opened by @Temikus as https://github.com/hashicorp/terraform-provider-docker/issues/211. It was migrated here as a result of the community provider takeover from @kreuzwerker. The original body of the issue is below.
Looks like this may be a reoccurrence of https://github.com/hashicorp/terraform/issues/19294
Starting with a recent upgrade of the provider (sadly I do not remember which one I've upgraded from) docker provider started forcing recreation of containers that have ports published.
Repro:
1) Fire up this example container:
2)
terraform apply
3) ssh onto the host 4)docker kill btsync
5)terraform plan
EXPECTED BEHAVIOUR:must_run
is set to false ACTUAL BEHAVIOUR:Note that this doesn't happen with another container that's also stopped but doesn't have ports defined, here's the example config: