Remote Exec
SSH
variable "ssh_host" {}
variable "ssh_user" {}
variable "ssh_target" {}
resource "null_resource" "ssh_target" {
connection {
type = "ssh"
user = var.ssh_user
host = var.ssh_host
private_key = file("/home/john-doe/.ssh/id_rsa")
}
}
remote-exec
resource "xxx" "xxx" {
provisioner "remote-exec" {
inline = [
"sudo apt update -qq > /dev/null",
"sudo apt install nginx -qq > /dev/null"
]
}
}
File
resource "xxx" "xxx" {
provisioner "file" {
source = "script.sh"
destination = "/tmp/script.sh"
}
}