hashicorp / terraform-provider-docker

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/kreuzwerker/docker/latest
https://registry.terraform.io/providers/kreuzwerker/docker/latest
Mozilla Public License 2.0
132 stars 91 forks source link

Remove the default value of container's log_driver and set `Computed: true` #270

Closed suzuki-shunsuke closed 4 years ago

suzuki-shunsuke commented 4 years ago

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

v0.12.26

Affected Resource(s)

Terraform Configuration Files

provider "docker" {
  version = "2.7.0"
}

resource "docker_image" "nginx" {
    name = "nginx"
}

resource "docker_container" "nginx" {
  image    = docker_image.nginx.latest
  name     = "nginx"
  restart  = "on-failure"
  must_run = "true"
}

Expected Behavior

When log-driver is set to none in the Docker daemon's configuration daemon.json, created container's log driver should be none.

https://docs.docker.com/config/containers/logging/configure/#configure-the-default-logging-driver

daemon.json

{
  "log-driver": "none"
}

Actual Behavior

Created container's log driver is json-file bacause log_driver's default value is json-file.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
$ terraform apply
$ docker inspect nginx # check LogConfig.

How to fix

Remove the default value of container's log_driver and set Computed: true.

suzuki-shunsuke commented 4 years ago

I have created a pull request to fix this issue. https://github.com/terraform-providers/terraform-provider-docker/pull/269

mavogel commented 4 years ago

Closed by #269