I am trying to copy the local directory to ec2 instance. It works fine if I copy a single file not for directory. Any help would be appreciated.
resource "null_resource" "cp_ansible" {
depends_on = [null_resource.provisioner]
triggers = {
always_run = timestamp()
}
provisioner "file" {
source = "../ansible/"
destination = "/home/ec2-user/ansible/"
connection {
type = "ssh"
host = aws_instance.bastion.public_ip
user = "ec2-user"
private_key = file("/tmp/keys/ec2-key")
insecure = true
}
}
}
Error:
│ Error: file provisioner error
│
│ with null_resource.cp_ansible,
│ on inventory.tf line 68, in resource "null_resource" "cp_ansible":
│ 68: provisioner "file" {
│
│ Upload failed: scp: /home/ec2-user/ansible/: Is a directory