commands that exceed timeouts are considered a success
Opened this issue · 1 comments
emilioziniades commented
Hi there, thanks for the cool provider. Am playing around with it, and ran into some weirdness. Consider this example main.tf
:
terraform {
required_providers {
ssh = {
source = "loafoe/ssh"
version = "2.6.0"
}
}
}
resource "ssh_resource" "long_running_ssh_command" {
host = "15.26.187.21"
user = "root"
password = "mysecurepassword"
timeout = "10s"
retry_delay = "1s"
commands = [
"sleep 300 && echo finished > /tmp/test.txt",
]
}
As you can see, the timeout limit is 10 seconds, but the command will actually take 300 seconds (5 minutes) to complete.
When I do terraform apply
, this is the output:
ssh_resource.long_running_ssh_command: Creating...
ssh_resource.long_running_ssh_command: Still creating... [10s elapsed]
ssh_resource.long_running_ssh_command: Creation complete after 11s [id=3395189971859253104]
Expected behaviour: resource creation fails, since it didn't complete within the timout.
Actual behaviour: resource creation succeeds, despite the command not completing before the timeout.
My short term hack is to use a gigantic timeout of "120m".
loafoe commented
Thanks for reporting this, it is indeed not what the resource should do. I'll think about a possible solution for this.