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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support extra_hosts, secrets attribute for docker_container resource #633

Open
neostage opened this issue Jul 2, 2024 · 0 comments
Open

Comments

@neostage
Copy link

neostage commented Jul 2, 2024

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
  }

# ...
}
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

No branches or pull requests

1 participant