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

Refresh kubeconfig when terraform state is lost #142

Closed
alita1991 opened this issue Nov 2, 2023 · 3 comments
Closed

Refresh kubeconfig when terraform state is lost #142

alita1991 opened this issue Nov 2, 2023 · 3 comments
Assignees
Labels
kind/question Further information is requested

Comments

@alita1991
Copy link

Hi,

I have a scenario, where I need to refresh the local kubeconfig with the one from the target host. Right now, terraform does not offer a way to copy a remote file to the local host.

hashicorp/terraform#3379

Is there a way to refresh the kubeconfig with the current module if I lose the tfstate or any other alternative solution that can be automated via terraform?

Thanks

@xunleii
Copy link
Owner

xunleii commented Nov 6, 2023

Hi @alita1991, the only way I can found today is using the external provider which allows you to make what you want and expose any information to Terraform (like a shell script that cat | sed the kubeconfig remotely).

@xunleii xunleii self-assigned this Nov 7, 2023
@xunleii xunleii added the kind/question Further information is requested label Nov 7, 2023
@alita1991
Copy link
Author

alita1991 commented Nov 9, 2023

Hi, sadly, the external provider does not allow the user to SSH directly, I decided to pick a module developed by the community called terraform-provider-ssh, which does what I need.

If there is a better solution, please let me know, if not, you can close this ticket.

@xunleii
Copy link
Owner

xunleii commented Nov 9, 2023

Thank you for sharing this, it will help the next ones who will ask this question.
Unfortunately, I currently have a better way to do this with a Terraform module.
I think the best way to handle this type of action (and others from different issues) is to migrate this module into a Terraform provider, which takes a lot more time to do and maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants