File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
iac/cloud/openstack/lib/openstack-keypair Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,17 @@ resource "openstack_compute_keypair_v2" "ssh_keypair" {
22 name = replace (format (" %skey" , var. naming_prefix ), " ." , " -" )
33}
44
5- resource "local_file" "private_key" {
6- content = openstack_compute_keypair_v2. ssh_keypair . private_key
7- filename = " ${ path . root } /id_rsa"
8- file_permission = " 0600"
9- }
5+ resource "null_resource" "save_ssh_keys" {
6+ triggers = {
7+ key_id = openstack_compute_keypair_v2.ssh_keypair.id
8+ }
109
11- resource "local_file" "public_key" {
12- content = openstack_compute_keypair_v2. ssh_keypair . public_key
13- filename = " ${ path . root } /id_rsa.pub"
14- file_permission = " 0644"
15- }
10+ provisioner "local-exec" {
11+ command = <<- EOT
12+ echo '${ openstack_compute_keypair_v2 . ssh_keypair . private_key } ' > ${ path . root } /id_rsa
13+ chmod 600 ${ path . root } /id_rsa
14+ echo '${ openstack_compute_keypair_v2 . ssh_keypair . public_key } ' > ${ path . root } /id_rsa.pub
15+ chmod 644 ${ path . root } /id_rsa.pub
16+ EOT
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments