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

feat: add new data source for docker_containers #644

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KetchupBomb
Copy link

Addresses #642 by adding a new data source -- docker_containers -- for listing containers.

Right now, the data source has no schema beyond what is computed. The primary attribute, containers, is currently a list of strings. This is a naive implementation that can be improved, but is still quite compatible with Terraform through jsondecode():

> jsondecode(data.docker_containers.this.containers[0]).Id
"037d3b70a777ad7f66ae60534545fed5d69c784cdf685810370ed4f2cfed9020"

The Docker Engine API endpoint exposes more parameters that can be incorporated into this data source, but I wanted to put this up for initial consideration and guidance for me as a Golang noob, and first time working with Terraform Provider development.

  • The Docker Engine API returns values without ordering, so as of right now, repeated terraform plan or terraform apply commands will likely report changes to the underlying data source.
  • I am unsure of how to write adequate testing for such a simple case. Even then, I noticed that purposefully writing incorrect test cases would not cause make test or go test to fail. Advice on making sure I am writing tests correctly would be appreciated.

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

Successfully merging this pull request may close these issues.

1 participant