Reputation: 4590
Learning Terraform and running into a weird issue when trying to create a directory. When this resource is executed it returns:
Error running command 'mkdir /home/user-a/docker': no such file or directory.
This command works locally on the target just fine. This is building a directory to put docker data.
resource "null_resource" "dockerarm1"{
connection {
type = "ssh"
user = "user-a"
password = "sojfadsfsdfsa"
host = "dockerarm1.local"
}
provisioner "local-exec" {
command = "mkdir /home/user-a/docker"
}
}
Upvotes: 0
Views: 1940
Reputation: 238189
Based on the comments.
local-exec
executes on a local machine. To run your commands on a remote host (Ubuntu) you need to use remote-exec:
The remote-exec provisioner invokes a script on a remote resource after it is created.
Upvotes: 1