kreuzwerker/terraform-provider-docker

Support `extra_hosts`, `secrets` attribute for `docker_container` resource

neostage opened this issue ยท 0 comments

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

I'm trying to use docker_container resource and it has no extra_hosts, secrets attribute.

New or Affected Resource(s)

  • docker_container

Potential Terraform Configuration

terraform {
# ...
}

resource "docker_container" "nginx" {
  image = "nginx:latest"
  name  = "nginx"

# ...

  extra_hosts {
    host = "host.docker.internal"
    ip   = "host-gateway"
  }

  extra_hosts {
    host = "foo"
    ip   = "bar"
  }

# ...
}
terraform {
# ...
}

resource "docker_secret" "postgres_password" {
  name = "postgres_password"
  data = file(local.password_file)
}

resource "docker_image" "postgres" {
  name = "postgres:latest"
}

resource "docker_container" "postgres" {
  name  = "postgres"
  image = docker_image.postgres

# ...

  env = [
    "POSTGRES_PASSWORD=/run/secrets/postgres_password"
  ]

  secrets {
    id = docker_secret.postgres_password.id
  }

# ...
}