-
Notifications
You must be signed in to change notification settings - Fork 1
/
remote_exec_bastion.tf
34 lines (29 loc) · 1.04 KB
/
remote_exec_bastion.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (c) 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#Upload private ssh key to bastion host to facilitate ssh access to backend instances
#Set the proper permissions(chmod 600) to the uploaded private key
resource "null_resource" "configure_bastion_host" {
provisioner "file" {
connection {
user = "opc"
agent = false
private_key = chomp(file(var.ssh_private_key_path))
timeout = "10m"
host = oci_core_instance.bastion_instance.public_ip
}
source = "/Users/cotudor/my_ssh_keys/cos_key.openssh"
destination = "/home/opc/.ssh/cos_key.openssh"
}
provisioner "remote-exec" {
connection {
user = "opc"
agent = false
private_key = chomp(file(var.ssh_private_key_path))
timeout = "10m"
host = oci_core_instance.bastion_instance.public_ip
}
inline = [
"chmod 600 /home/opc/.ssh/cos_key.openssh"
]
}
}