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

Docker Container List data source

Open KetchupBomb opened this issue 1 year ago • 0 comments
trafficstars

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

Description

Looking for a data source for listing containers. Specifically, the /containers Docker Engine API endpoint.

New or Affected Resource(s)

  • New data docker_containers

Potential Terraform Configuration

data "docker_containers" "this" {}
ouput "container_fingerprint" {
  description = "Toy example mapping Container IDs to an md5sum fingerprint of its configuration"
  value       = { for c in data.docker_containers.this : c.ID => md5(jsonencode(c)) }
}

References

Thanks for this Provider!

  • Docker Engine API endpoint
  • Golang SDK function
  • One existing call site of relevant Golang function: https://github.com/kreuzwerker/terraform-provider-docker/blob/54685a5fb9b375961620d2c555c7f3925327112c/internal/provider/resource_docker_container_funcs.go#L917

I couldn't find any issues that seemed to match the need for listing containers for enumeration, which I'm surprised by. Sorry if I missed a relevant existing issue.

I am a Golang noob, and I've never written a Terraform Provider before, but this might be a good place for me to cut my teeth. Wanted to flag it for consideration to see if this has already been discussed as a Won't Do or something.

Thanks for your consideration

KetchupBomb avatar Aug 24 '24 05:08 KetchupBomb