Closed aronchick closed 1 year ago
Hi @aronchick,
If you have confirmed that the /node/install-tailscale.sh
is transferred correctly, then it seems there is something incorrect in the remote-exec script. It may help to set set -o errexit
in your script, especially since you finish with echo 0
which will ensure that any exit status from the prior command is lost.
More clues may be found in the sshd debug logs, which could verify what commands were received and executed. The fact that you are sending systemctl restart sshd
to the server before connecting and running another command may be interfering as well.
Since the execution of the remote commands is outside of the control of Terraform, it's unlikely that there's anything we can fix here. The community forum may have others who can help debug your problem, and if in doing so you do find an issue caused by Terraform, feel free to file a new bug report with the new information to replicate the problem.
Thanks!
i appreciate the feedback - due to terraform's issues, i ended up rearchitecting it. I guess the most fundamental thing is that "exit 0" SEEMS like it should have been a good thing for terraform. What's the alternative?
I'm not sure what the intent of exit 0
would be there. It either does nothing because the default exit code is 0, or it hides an error from the previous command, neither of which seem helpful. A more robust script would ensure that each individual command succeeded in full, which can be done bluntly with set -o errexit
(though the script may not have been the problem at all, but that would need to be debugged on the server).
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
The script should have run
Actual Behavior
The script exited with 0 (but did not complete the terraform apply).
Steps to Reproduce
terraform apply
Additional Context
I am trying to install and run Tailscale during a terraform install (I do not think this is a tailscale related issue, just as an example.
The resource.tf file is here:
Terraform recommends against using remote-exec/provisioners and instead using Packer, but due to the nature of this deployment, I would prefer to do these installations in this way.
The closest research I got to was here -https://github.com/hashicorp/terraform/issues/18517 - which feels correct, but adding the keep alive did not seem to help at all.
Not sure what to do at this point - the script runs fine, this is provable when I log in.
References
No response