Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: The terraform-provider-docker_v3.0.1 plugin crashed!" made by "docker_logs" data #544

Open
callmefish opened this issue Apr 25, 2023 · 0 comments

Comments

@callmefish
Copy link

callmefish commented Apr 25, 2023

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.3.5
on linux_amd64
+ provider registry.terraform.io/hashicorp/time v0.9.1
+ provider registry.terraform.io/kreuzwerker/docker v3.0.1

Your version of Terraform is out of date! The latest version
is 1.4.5. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • docker_logs

Terraform Configuration Files

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

resource "docker_container" "example" {
  # ... a container running a bash script ...
  # ... the script only contains some curl requests ...
}

resource "time_sleep" "wait_30" {
  depends_on = [
    docker_container.example
  ]
  create_duration = "30s"
}

data "docker_logs" "my_logs" {
  depends_on = [
    time_sleep.wait_30
  ]
  name = docker_container.example.name
  tail         = 30
}

output "output_logs" {
  value = data.docker_logs.my_logs.logs_list_string
}

Debug Output

Panic Output

╷
│ Error: Plugin did not respond
│ 
│   with module.xxx.data.docker_logs.my_logs,
│   on .terraform/modules/xxx/main.tf line 106, in data "docker_logs" "my_logs":
│  106: data "docker_logs" "my_logs" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details.
╵

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

panic: runtime error: slice bounds out of range [8:7]

goroutine 434 [running]:
github.com/terraform-providers/terraform-provider-docker/internal/provider.dataSourceDockerLogsRead({0xfc47b0, 0xc000610900}, 0x0?, {0xce8260?, 0xc0003be240?})
        github.com/terraform-providers/terraform-provider-docker/internal/provider/data_source_docker_logs.go:118 +0x893
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0004bab60, {0xfc47e8, 0xc000590c90}, 0xd?, {0xce8260, 0xc0003be240})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:724 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0004bab60, {0xfc47e8, 0xc000590c90}, 0xc0001e8a00, {0xce8260, 0xc0003be240})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:943 +0x145
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00000d710, {0xfc47e8?, 0xc000590b70?}, 0xc00061c140)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1179 +0x38f
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc0003ea140, {0xfc47e8?, 0xc000590360?}, 0xc0005f4320)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:658 +0x3ef
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0xe20de0?, 0xc0003ea140}, {0xfc47e8, 0xc000590360}, 0xc00033a770, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:421 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000003c0, {0xfc7960, 0xc000583d40}, 0xc0006e4240, 0xc0004c5da0, 0x1557c50, 0x0)
        google.golang.org/[email protected]/server.go:1340 +0xd13
google.golang.org/grpc.(*Server).handleStream(0xc0000003c0, {0xfc7960, 0xc000583d40}, 0xc0006e4240, 0x0)
        google.golang.org/[email protected]/server.go:1713 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:963 +0x28a

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

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behaviour

The "docker_logs" read all stdout result from the docker container after 30 seconds.

Actual Behaviour

"terraform apply -auto-approve" failed, and show the above debug output.

Steps to Reproduce

  1. terraform init
  2. terraform validate
  3. terraform apply -auto-approve

Important Factoids

Running the docker daemon with SSH

References

  • #0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant