Hi,
I am using a amazon linux 2.
I am getting desperate regarding the following issue:
I cannot execute the local-exec due to
scp: /tmp permission denied
resource "null_resource" "rerun" {
triggers = {
rerun = uuid()
}
provisioner "file" {
source = "${path.module}/sources"
destination = "/tmp"
connection {
type = "ssh"
user = "${var.aws_ssh_user}"
private_key = "${data.aws_secretsmanager_secret_version.kibana_proxy_ssh_value.secret_string}"
host = "${aws_instance.logstash.private_ip}"
}
}
provisioner "file" {
source = "./creds"
destination = "/tmp"
connection {
type = "ssh"
user = "${var.aws_ssh_user}"
private_key = "${data.aws_secretsmanager_secret_version.kibana_proxy_ssh_value.secret_string}"
host = "${aws_instance.logstash.private_ip}"
}
}
provisioner "remote-exec" {
inline = [
"cp creds/.htpasswd.${var.aws_env} creds/.htpasswd",
"sudo chmod +x /sources.ansible.sh",
"sudo sources/ansible.sh ${var.es_fqdn} ${var.kibana_domain}"
]
connection {
type = "ssh"
user = "${var.aws_ssh_user}"
private_key = "${data.aws_secretsmanager_secret_version.kibana_proxy_ssh_value.secret_string}"
host = "${aws_instance.logstash.private_ip}"
}
}
}
Output:
module.logstash-instance.null_resource.rerun (remote-exec): Connecting to remote host via SSH...
module.logstash-instance.null_resource.rerun (remote-exec): Host: 10.135.202.29
module.logstash-instance.null_resource.rerun (remote-exec): User: ec2-user
module.logstash-instance.null_resource.rerun (remote-exec): Password: false
module.logstash-instance.null_resource.rerun (remote-exec): Private key: true
module.logstash-instance.null_resource.rerun (remote-exec): Certificate: false
module.logstash-instance.null_resource.rerun (remote-exec): SSH Agent: false
module.logstash-instance.null_resource.rerun (remote-exec): Checking Host Key: false
module.logstash-instance.null_resource.rerun (remote-exec): Connected!
Failed to upload script: scp: /tmp: Permission denied