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 91 forks source link

Allow zero replicas for services #221

Closed xanderflood closed 4 years ago

xanderflood commented 5 years ago

The provider currently enforces that all configured docker_services have at least one replica. The underlying Swarm SDK supports zero replicas, and there are valid use cases for this:

  1. When using the swarm-cronjob tool to run a Docker container as a cron job, one configures a service with zero replicas and allows the swarm cron manager to instantiate the service as needed.
  2. It's also useful for debugging by temporarily disabling a container without destroying the resource.

Since this is a one-character change, I went ahead and created a PR for it (https://github.com/terraform-providers/terraform-provider-docker/pull/220).

xanderflood commented 5 years ago

I added a note to #220 about the fact that #217 will screw it up, and it may screw up other intervening PRs as well. In most cases the unit tests should catch it, but not in this case because we're not unit testing all the validations (which seems reasonable to me). Whenever/ifever these two PRs are merged, there will need to be some code intervention between them.

etienne-napoleone commented 5 years ago

Yep can confirm it is needed in some cases for periodic jobs that are triggered from another source.