-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
expose kubeconfig as terraform output #28
Conversation
Ah, that didn't work as expected. |
Seems interesting! Curious to see where this leads. |
351f3d1
to
20f5025
Compare
@mysticaltech This got a bit bigger than expected:
What do you think? Is this a feasible approach? This is still a draft atm, because it does not work with SSH agents yet, because the remote provider used does not support it yet, waiting for tenstad/terraform-provider-remote#31 :D |
Definitely could work! It also seems like a cleaner way of doing things, not dispersed between local and remote. Keep up the good work man! |
tenstad/terraform-provider-remote#31 has been merged :-) |
@mysticaltech Hi, I think we should wait until terraform-provider-remote cuts a new release, because I don't think binaries are available before that, so users would need to build the provider themselves. Regarding the new OS: I did some experiments with Ranchers cOS-toolkit as well as Fedora CoreOS, but nothing to release yet. OpenSuSE MicroOS looks interesting as well, but I wont have time too look into it properly for at least a week |
Good to hear, thanks @phaer! |
A new release has been published: https://github.com/tenstad/terraform-provider-remote/releases/tag/v0.0.23 Should we merge that as is? I am going to try to rebase this onto the staging branch this week. EDIT: also started work on the same thing + staging changes. https://github.com/phaer/kube-hetzner/tree/expose-kubeconfig-staging. Does not work for me yet, because of some strange ssh issue where authentication via terraform works before first reboot, but does not after while it's seemingly trying the same public key. And interactive ssh authentication works both before and after the reboot. |
This makes the output of `terraform output` a bit more verbose, but allows to use kubeconfig when including kube-hetzner into other terraform projects without having the path depend on the modules source. It would also enable us to use hashicorp/kubernetes in in the future, while still passing `terraform validate`, because kubeconfig is now part of terraforms dependency graph. Example terraform code: module "kube-hetzner" { source = "./kube-hetzner" hcloud_token = "hahaha-not-really" public_key = "/home/me/.ssh/my-first-key.pub" private_key = null location = "fsn1" agent_server_type = "cpx21" control_plane_server_type = "cpx11" lb_server_type = "lb11" servers_num = 2 agents_num = 2 hetzner_ccm_containers_latest = true hetzner_csi_containers_latest = true } resource "local_file" "kubeconfig" { content = module.kube-hetzner.kubeconfig filename = "kubeconfig.yaml" } output "controlplanes_public_ip" { value = module.kube-hetzner.controlplanes_public_ip }
34ebebe
to
2e5bce6
Compare
@phaer When staging merges into master, we will have a What I propose is that you rebase for staging, make sure everything works, and I will go through it again. I need to test it and understand it because a lot of changes are going on. Please 🙏 |
superseeded by #46 |
This makes the output of
terraform output
a bit more verbose,but allows to use kubeconfig when including kube-hetzner into
other terraform projects without having the path depend on the
modules source. It's local in this example but could just as well
be a remote github repository.
Example terraform code: