kreuzwerker / terraform-provider-docker

Terraform Docker provider
Mozilla Public License 2.0
609 stars 187 forks source link

Support for handling API errors from Podman #584

Open lirremotus opened 11 months ago

lirremotus commented 11 months ago

Community Note

Description

The Coder (coder.com) application makes use of this Terraform provider to interact with Docker. For the most part, when replacing Docker with Podman, this continues to work very well, which is awesome! I have noticed a small inconsistency in how error messages are reported from the Podman API vs the Docker API that causes an error to be reported in Coder (although the functionality still works), and which I believe could be easily worked around here to allow more complete replacement of Docker with Podman in some situations.

When the Docker API returns an error indicating that there is no such container, the response is "No such container". Podman returns "no such container" (lowercase). My suggestion is to make containsIgnorableErrorMessage (in internal/provider/helpers.go) lowercase the errorMsg and ignorableErrorMessages that it takes in so that the comparison would work for either case, and allow more interoperability with the Podman API.

New or Affected Resource(s)

Potential Terraform Configuration

References

lirremotus commented 10 months ago

It looks like #583 will resolve this issue, since it implements the changes proposed here.