how to Terraform cloud #385
-
Does anybody has a docs or guideline how to run from Terraform cloud? Obviously I don't want to pass that directly into my files in the repo but instead using secrets or something? How can I do something like this? I suppose I need to replace the values in the kube.tf file with a var name and then pass it via Github secrets? And then Terraform needs to somehow understand var1 = secret1 kind of trickery? For the SSH keys, I was considering just uploading them directly into Hcloud project and then reference back from Terraform with below option. Less headaches, at least I though so...
So all keys will be coming from the label. Do I also then set the initial ssh key to null? Or is this a requirement to always pass the first initial key as minimum?
I basically have 3 persons each have their own SSH key. But I don't want the hassle to move that SSH key stuff around on my local since Im on TF cloud anyway.
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
@codeagencybe All should work out of the box already. Just choose the execution mode of "local" see #162, and I guess you can have your SSH keys next to your kube.tf, or point to them via label see #356. About the token, I guess you could just use a workplace variable, https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables (but haven't tried myself). |
Beta Was this translation helpful? Give feedback.
-
update: I tried with both "null" and "" (empty string" and also commented the lines, and all fail as below error It still need some extra stuff in the Terraform script to be able to use variables as you can clearly see TF cloud is picking up my variable, but it doesn't know where to go with it. |
Beta Was this translation helpful? Give feedback.
-
update 2: For Terraform Cloud, you need a file variables.tf, otherwise it won't work with cloud version.
inside kube.tf, you have to call it like this:
I got a run working. Woohoo! |
Beta Was this translation helpful? Give feedback.
@codeagencybe All should work out of the box already. Just choose the execution mode of "local" see #162, and I guess you can have your SSH keys next to your kube.tf, or point to them via label see #356.
About the token, I guess you could just use a workplace variable, https://developer.hashicorp.com/terraform/cloud-docs/workspaces/variables (but haven't tried myself).