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

new data type: tunnel (port forward) #2438

Closed
geektheripper opened this issue Mar 6, 2024 · 1 comment
Closed

new data type: tunnel (port forward) #2438

geektheripper opened this issue Mar 6, 2024 · 1 comment

Comments

@geektheripper
Copy link

geektheripper commented Mar 6, 2024

Description

tunnel forward local port to specific kubernetes resource, like what kubectl port-forward do

it helps users to access services inside kubernetes, such as databases

Potential Terraform Configuration

data "kubernetes_tunnel" "postgresql" {
  namespace = "database"
  resource  = "deployment/postgresql-deployment"
  port      = 5432
}

provider "postgresql" {
  host = data.kubernetes_tunnel.postgresql.localhost
  port = data.kubernetes_tunnel.postgresql.localport
  # ......
}

data "kubernetes_tunnel" "minio" {
  namespace = "storage"
  resource  = "service/minio-service"
  port      = "http"
}

provider "minio" {
  minio_server = "${data.kubernetes_tunnel.minio.localhost}:${data.kubernetes_tunnel.minio.localport}"
  # ......
}

resource "minio_s3_bucket" "bililive_rec" {
  bucket = "bililive-rec"
  acl    = "public-read"
  quota  = 109951162777600
}

References

https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/portforward/portforward.go
https://github.com/flaupretre/terraform-ssh-tunnel

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@jrhouston
Copy link
Collaborator

Thanks for opening this @geektheripper. This is actually a duplicate of #812. Please see my comment on that issue thread on why a port-foward/tunnel can't be created inside this provider, and that this is a problem that should be solved upstream in terraform itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants