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

Plugin crashes when using `wait=true` with no healthcheck command

Open 0xall opened this issue 2 years ago • 0 comments

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.5.2 on darwin_arm64

Affected Resource(s)

  • docker_container

Terraform Configuration Files

terraform {
  required_providers {
    docker = {
      source  = "kreuzwerker/docker"
      version = "3.0.2"
    }
  }
}

resource "docker_image" "nginx" {
  name         = "nginx:latest"
  keep_locally = true
}

resource "docker_container" "nginx" {
  image = docker_image.nginx.name
  name  = "nginx"
  ports {
    internal = 80
    external = 8080
  }
  wait = true
}

Panic Output

Stack trace from the terraform-provider-docker_v3.0.2 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10317c3f4]

goroutine 97 [running]:
github.com/terraform-providers/terraform-provider-docker/internal/provider.resourceDockerContainerCreate.func1(0x0?)
        github.com/terraform-providers/terraform-provider-docker/internal/provider/resource_docker_container_funcs.go:508 +0x154
created by github.com/terraform-providers/terraform-provider-docker/internal/provider.resourceDockerContainerCreate
        github.com/terraform-providers/terraform-provider-docker/internal/provider/resource_docker_container_funcs.go:521 +0x2384

Error: The terraform-provider-docker_v3.0.2 plugin crashed!

Expected Behaviour

Since its wait value is true, it should wait until healthy. But it does not have healthcheck value, so there is no way to check it. So, it should raise error for terraform apply or terraform validate commands.

Actual Behaviour

  1. It doesn't raise any error for terraform validate command.
  2. It crashes when executing terraform apply.

Steps to Reproduce

  1. terraform apply

0xall avatar Jul 06 '23 16:07 0xall