Deepak
Deepak

Reputation: 13

Getting the error in terraform code while trying to connect to linux server in OCI cloud shell . ------Failed to read ssh private key: no key found

Getting the error in terraform code while trying to connect to linux server in OCI cloud shell . ------Failed to read ssh private key: no key found Below is my code : -


resource "null_resource" "remote-exec" {
        
    
    provisioner "remote-exec" {
        connection {
            agent = false
            timeout = "10m"
            host ="xx.xx.x.x" 
            user = var.host_user_name
            private_key =file("${path.module}/integerebspvtkey.ssh.ppk")
        }
        inline = [
            ...
        ]
    }
    }



    variable "host_user_name"{
          default="opc"
    }

integerebspvtkey.ssh.ppk is the private key present in the same directory from where I am running the terraform

Upvotes: 1

Views: 339

Answers (1)

Marcin
Marcin

Reputation: 238081

Based on the comments.

The issue was wrong format of the key. Instead of ppk, it should be pem.

Upvotes: 1

Related Questions