Skip to content

Drift in docker_service rollback_config.max_failure_ratio between '0' and '0.0' #818

@oneingan

Description

@oneingan

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and docker Provider) Version

Terraform v1.13.4
on x86_64-linux

Provider "registry.terraform.io/kreuzwerker/docker" v3.6.2

Affected Resource(s)

  • docker_service

Terraform Configuration Files

# Minimal reproducible example. Adjust as needed, but ensure it's self-contained and uses public images if possible.

terraform {
  required_providers {
    docker = {
      source  = "kreuzwerker/docker"
      version = "~> 3.0" 
    }
  }
}

provider "docker" {
  host = "unix:///var/run/docker.sock"
}

resource "docker_service" "example" {
  name = "example-service"

  task_spec {
    container_spec {
      image = "nginx:latest" 
    }
  }

  rollback_config {
    parallelism       = 1
    delay             = "3s"
    failure_action    = "continue"
    monitor           = "5s"
    max_failure_ratio = 0.0  # Or 0 -- issue persists with either
    order             = "stop-first"
  }
}

Panic Output

None.

Expected Behaviour

Running terraform plan after an initial apply should show no changes or drift in the rollback_config.max_failure_ratio attribute, regardless of whether it's set to 0 or 0.0 in the configuration.

Actual Behaviour

Every terraform plan detects drift in rollback_config.max_failure_ratio, attempting to update it in-place from "0.0" to "0" (or vice versa, depending on the config value used). This happens even when the config matches the current state value.

Example plan output:

Terraform will perform the following actions:

  # docker_service.example will be updated in-place
  ~ resource "docker_service" "example" {
        id   = "some-id"
        name = "example-service"
      ~ rollback_config {
          ~ max_failure_ratio = "0.0" -> "0"
            # (5 unchanged attributes hidden)
        }
        # (other unchanged blocks hidden)
    }

Steps to Reproduce

  1. terraform init
  2. terraform plan (shows the drift/update)

Important Factoids

  • Running Docker Engine version 28.5.1
  • Host OS: NixOS
  • Using Docker Swarm mode.
  • The issue persists whether max_failure_ratio is set to "0" or "0.0" in the TF config.

References

  • No similar open issues found in the repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r/serviceRelates to the service resource

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions