Terraformにおいてローカルでssh-keygenを行い、作成された内容を利用する

備忘

TerraformにおいてローカルでSshキーを作成して利用するには、tls_private_keyリソースを利用する方法も考えられるが、公式でも触れているとおり、tfstateに秘密キーを情報が含まれてしまう為、特にproduction環境では望ましくない。

tls_private_key (Resource)
https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key

Security Notice
The private key generated by this resource will be stored unencrypted in your Terraform state file. **Use of this resource for production deployments is not recommended.** Instead, generate a private key file outside of Terraform and distribute it securely to the system where Terraform will be run.

ここでは、ssh-keygenコマンドより作成された公開キーの内容を利用することで、秘密キーに関する情報をtfstateに残さない対応を考える。

# 環境
Terraform v1.3.9


# ソリューション例

local-execにて、ローカルにssh keyファイルを作成
その完了を、depends_onを用いて待って、local_file (Data Source)にて内容を取得 


```tf
// ssh keyを置くディレクトリー
variable "ssh_keys" {
  type = string
  #default = "~/.ssh/"
  default = "."
}

// ノード名。外部から指定しなければnode01を使用。
variable "nodes" {
  type = list(
    object(
      { name = string, },
    )
  )
  default = [
    { name = "node01", },
  ]
}

// ssh-keygenコマンドは、キーファイルが既に存在する場合、上書きしないが、エラーで終わるのでexit 0を追加している。
resource "null_resource" "ssh-keygen" {
  count = length(var.nodes)
  provisioner "local-exec" {
    command = "ssh-keygen -m PEM  -C '' -N '' -f ${var.ssh_keys}/id_rsa_${var.nodes[count.index].name}; exit 0"
  }
}

// local_file (Data Source)にて公開キーの内容を取得。content属性にて確認できる
// file("ファイル名")によるファイル内容取得は、apply実行時点でファイルが存在しないとエラーとなってしまい使用できなかった。

data "local_file" "ssh-keygen" {
  count      = length(var.nodes)
  filename   = "${var.ssh_keys}/id_rsa_${var.nodes[count.index].name}.pub"
  depends_on = [null_resource.ssh-keygen]
}

// 公開キーの内容を表示。実際には公開キーの情報をクラウドのリソースで利用するケースが多いでしょう。
output "pub_keys" {
  value = data.local_file.ssh-keygen[*].content
}
```


## 実行

### 初期化
```
$ terraform init 
...
```

```
$ terraform validate
Success! The configuration is valid.
```

### ノード情報は環境変数から渡してみる
```
$ export TF_VAR_nodes='[ {name="node03"}, {name="node04"} ]' 
```
### 実行
```
$ terraform apply --auto-approve 

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.local_file.ssh-keygen[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "local_file" "ssh-keygen" {
      + content        = (known after apply)
      + content_base64 = (known after apply)
      + filename       = "./id_rsa_node03.pub"
      + id             = (known after apply)
    }

  # data.local_file.ssh-keygen[1] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "local_file" "ssh-keygen" {
      + content        = (known after apply)
      + content_base64 = (known after apply)
      + filename       = "./id_rsa_node04.pub"
      + id             = (known after apply)
    }

  # null_resource.ssh-keygen[0] will be created
  + resource "null_resource" "ssh-keygen" {
      + id = (known after apply)
    }

  # null_resource.ssh-keygen[1] will be created
  + resource "null_resource" "ssh-keygen" {
      + id = (known after apply)
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + pub_keys = [
      + (known after apply),
      + (known after apply),
    ]
null_resource.ssh-keygen[0]: Creating...
null_resource.ssh-keygen[1]: Creating...
null_resource.ssh-keygen[1]: Provisioning with 'local-exec'...
null_resource.ssh-keygen[1] (local-exec): Executing: ["/bin/sh" "-c" "ssh-keygen -m PEM  -C '' -N '' -f ./id_rsa_node04; exit 0"]
null_resource.ssh-keygen[0]: Provisioning with 'local-exec'...
null_resource.ssh-keygen[0] (local-exec): Executing: ["/bin/sh" "-c" "ssh-keygen -m PEM  -C '' -N '' -f ./id_rsa_node03; exit 0"]
null_resource.ssh-keygen[1] (local-exec): Generating public/private rsa key pair.
null_resource.ssh-keygen[1] (local-exec): Your identification has been saved in ./id_rsa_node04
null_resource.ssh-keygen[1] (local-exec): Your public key has been saved in ./id_rsa_node04.pub
null_resource.ssh-keygen[1] (local-exec): The key fingerprint is:
null_resource.ssh-keygen[1] (local-exec): SHA256:FDYoqyMM24BqAKoTXyLqb4BIaN6AXiFgzEPtkkimANk
null_resource.ssh-keygen[1] (local-exec): The key's randomart image is:
null_resource.ssh-keygen[1] (local-exec): +---[RSA 3072]----+
null_resource.ssh-keygen[1] (local-exec): |O=.    .+        |
null_resource.ssh-keygen[1] (local-exec): |=BEo. .. o       |
null_resource.ssh-keygen[1] (local-exec): |% = .o  .        |
null_resource.ssh-keygen[1] (local-exec): |&*.oo  .         |
null_resource.ssh-keygen[1] (local-exec): |#B=+    S        |
null_resource.ssh-keygen[1] (local-exec): |X*=.             |
null_resource.ssh-keygen[1] (local-exec): |oo..             |
null_resource.ssh-keygen[1] (local-exec): | . .             |
null_resource.ssh-keygen[1] (local-exec): |  o.             |
null_resource.ssh-keygen[1] (local-exec): +----[SHA256]-----+
null_resource.ssh-keygen[1]: Creation complete after 0s [id=3802793460838414525]
null_resource.ssh-keygen[0] (local-exec): Generating public/private rsa key pair.
null_resource.ssh-keygen[0] (local-exec): Your identification has been saved in ./id_rsa_node03
null_resource.ssh-keygen[0] (local-exec): Your public key has been saved in ./id_rsa_node03.pub
null_resource.ssh-keygen[0] (local-exec): The key fingerprint is:
null_resource.ssh-keygen[0] (local-exec): SHA256:X9pbZIACSFJFhICLs93FhQztkgGhuUyYIpLsyIcABVs
null_resource.ssh-keygen[0] (local-exec): The key's randomart image is:
null_resource.ssh-keygen[0] (local-exec): +---[RSA 3072]----+
null_resource.ssh-keygen[0] (local-exec): |o+E*+X=.         |
null_resource.ssh-keygen[0] (local-exec): |=B .+ +..  .     |
null_resource.ssh-keygen[0] (local-exec): |&+   = .. . .    |
null_resource.ssh-keygen[0] (local-exec): |#.. o +  .   .   |
null_resource.ssh-keygen[0] (local-exec): |oO o o  S   . o  |
null_resource.ssh-keygen[0] (local-exec): |. o .    . + o   |
null_resource.ssh-keygen[0] (local-exec): |          o . .  |
null_resource.ssh-keygen[0] (local-exec): |             o   |
null_resource.ssh-keygen[0] (local-exec): |            .    |
null_resource.ssh-keygen[0] (local-exec): +----[SHA256]-----+
null_resource.ssh-keygen[0]: Creation complete after 1s [id=65923644069703909]
data.local_file.ssh-keygen[0]: Reading...
data.local_file.ssh-keygen[1]: Reading...
data.local_file.ssh-keygen[0]: Read complete after 0s [id=b08bc1103b1d8aa05f22be806d89df833d41503c]
data.local_file.ssh-keygen[1]: Read complete after 0s [id=ea71dd91fbe9071a4ece7c3a41d5727b906e8792]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Outputs:

pub_keys = [
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPY3dlM/S4EVCkVF7GgRyziJ4az/r2O0x5zP0IDRBaIgpjLqQQXaVE7BKzAOY9sS3DqeUT1KyfePP43ctEA2zmnoQVM1eI7w5XDRsxk9MrpvKanWnWOuq8gTj4/6HFOb3NTgZVte/hCM7XwxJmA6KVgAlk9axakmgC1OvPpFDZek+hBy4NpIP5UWGknSukQcZneXvbn2WoLebdZJ5TRCW8TdiLT+tpaeg2hwBH1y8uIyhQI3mdDydp2dYexiFi83bbADtxrOKBRxP12zrG7htUgaMZTxdeBMxDhv+MIbPxzDN0+B4iR6d0hKHTaH3cB7KARK+6mYhDG5vMhYzuodzWJoKLIDVRSQVVtZRs2Yx8bZKqNHcyGtfgEgMgwwlKWMW65fFscbEOcJMY1oEvv9vmKb8s3qI2mmVLYn6C63u6liX606t7vTyRjq21dXwJOPcNARJiAnwP4YPhROmK8g/9XTzHxBSP/EVUvbDRlgtKuqtxssf+RrosJk1LdpAHSTc= 
  
  EOT,
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCXOa0wOsAV03DZ/IUlvGxROXOO6ugdFe3e+6y1yCJ7SuYe8WzJe20Fa/es8qV2e/CLoBEhUSimrjyS7bzY/NbdpBebGbHZRY87ols3JhnXNHjLC3RvBx0PoNd4wJUYwG0LNfdfSL6HYFXJfIVVi/bFgiJH9qiBAsZdHUEbuzVagQsaEQDdVOmdNy3vZ4A+Pz3wWLfIXctseFycl6Arrje73DQBzmCz/5qrtTES6YqGmjLQh9m0CIJRhlzKK5uyZ/OyGTLM3saybuPnQG2k57jBroko7bLZpbhNNx+jIE0PJTsi0uSYC2+3+V0sUhgaksAveN9XaUpHXm4XVa7IwH4EmMdViW2VNNashwkqp1M5p7B8Zy7U+CxtXc8ZhrTAYhTRefnSGK5gWslpBtQNFpA5p+Ius1enEGHfSmtP/LnnnzisylVgSUPLqKgYqMeWYiy5Q8fC2mR3Mr/T6PMnc4bfrOT6wzXsAOdqmkjtdJgZzOwjLmwKH4UPcsnM4e51kH8= 
  
  EOT,
]
```
### キーファイルが作成されている
```
$ ls
id_rsa_node03  id_rsa_node03.pub  id_rsa_node04  id_rsa_node04.pub  main.tf  terraform.tfstate
```
### 秘密キーがtfstateに含まれていないことの確認
```
$ head id_rsa_node03
-----BEGIN RSA PRIVATE KEY-----
MIIG5QIBAAKCAYEAz2N3ZTP0uBFQpFRexoEcs4ieGs/69jtMecz9CA0QWiIKYy6k
EF2lROwSswDmPbEtw6nlE9Ssn3jz+N3LRANs5p6EFTNXiO8OVw0bMZPTK6bymp1p
1jrqvIE4+P+hxTm9zU4GVbXv4QjO18MSZgOilYAJZPWsWpJoAtTrz6RQ2XpPoQcu
DaSD+VFhpJ0rpEHGZ3l7259lqC3m3WSeU0QlvE3Yi0/raWnoNocAR9cvLiMoUCN5
nQ8nadnWHsYhYvN22wA7cazigUcT9ds6xu4bVIGjGU8XXgTMQ4b/jCGz8cwzdPge
IkendISh02h93AeygESvupmIQxubzIWM7qHc1iaCiyA1UUkFVbWUbNmMfG2SqjR3
MhrX4BIDIMMJSljFuuXxbHGxDnCTGNaBL7/b5im/LN6iNpplS2J+gut7upYl+tOr
e708kY6ttXV8CTj3DQESYgJ8D+GD4UTpivIP/V08x8QUj/xFVL2w0ZYLSrqrcbLH
/ka6LCZNS3aQB0k3AgMBAAECggGABNzaMdSetP+C7+IijsOm6UwXbkguJD6OXn9r
```


```
$ grep MIIG5QIBAAKCAYEAz2N3ZTP0uBFQpFRexoEcs4ieGs/69jtMecz9CA0QWiIKYy6k terraform.tfstate 
```

### 再実行1

```
$ terraform apply --auto-approve 
null_resource.ssh-keygen[0]: Refreshing state... [id=65923644069703909]
null_resource.ssh-keygen[1]: Refreshing state... [id=3802793460838414525]
data.local_file.ssh-keygen[0]: Reading...
data.local_file.ssh-keygen[1]: Reading...
data.local_file.ssh-keygen[0]: Read complete after 0s [id=b08bc1103b1d8aa05f22be806d89df833d41503c]
data.local_file.ssh-keygen[1]: Read complete after 0s [id=ea71dd91fbe9071a4ece7c3a41d5727b906e8792]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

pub_keys = [
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPY3dlM/S4EVCkVF7GgRyziJ4az/r2O0x5zP0IDRBaIgpjLqQQXaVE7BKzAOY9sS3DqeUT1KyfePP43ctEA2zmnoQVM1eI7w5XDRsxk9MrpvKanWnWOuq8gTj4/6HFOb3NTgZVte/hCM7XwxJmA6KVgAlk9axakmgC1OvPpFDZek+hBy4NpIP5UWGknSukQcZneXvbn2WoLebdZJ5TRCW8TdiLT+tpaeg2hwBH1y8uIyhQI3mdDydp2dYexiFi83bbADtxrOKBRxP12zrG7htUgaMZTxdeBMxDhv+MIbPxzDN0+B4iR6d0hKHTaH3cB7KARK+6mYhDG5vMhYzuodzWJoKLIDVRSQVVtZRs2Yx8bZKqNHcyGtfgEgMgwwlKWMW65fFscbEOcJMY1oEvv9vmKb8s3qI2mmVLYn6C63u6liX606t7vTyRjq21dXwJOPcNARJiAnwP4YPhROmK8g/9XTzHxBSP/EVUvbDRlgtKuqtxssf+RrosJk1LdpAHSTc= 
  
  EOT,
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCXOa0wOsAV03DZ/IUlvGxROXOO6ugdFe3e+6y1yCJ7SuYe8WzJe20Fa/es8qV2e/CLoBEhUSimrjyS7bzY/NbdpBebGbHZRY87ols3JhnXNHjLC3RvBx0PoNd4wJUYwG0LNfdfSL6HYFXJfIVVi/bFgiJH9qiBAsZdHUEbuzVagQsaEQDdVOmdNy3vZ4A+Pz3wWLfIXctseFycl6Arrje73DQBzmCz/5qrtTES6YqGmjLQh9m0CIJRhlzKK5uyZ/OyGTLM3saybuPnQG2k57jBroko7bLZpbhNNx+jIE0PJTsi0uSYC2+3+V0sUhgaksAveN9XaUpHXm4XVa7IwH4EmMdViW2VNNashwkqp1M5p7B8Zy7U+CxtXc8ZhrTAYhTRefnSGK5gWslpBtQNFpA5p+Ius1enEGHfSmtP/LnnnzisylVgSUPLqKgYqMeWYiy5Q8fC2mR3Mr/T6PMnc4bfrOT6wzXsAOdqmkjtdJgZzOwjLmwKH4UPcsnM4e51kH8= 
  
  EOT,
]
```
### 削除
```
$ terraform destroy --auto-approve 
null_resource.ssh-keygen[1]: Refreshing state... [id=3802793460838414525]
null_resource.ssh-keygen[0]: Refreshing state... [id=65923644069703909]
data.local_file.ssh-keygen[1]: Reading...
data.local_file.ssh-keygen[0]: Reading...
data.local_file.ssh-keygen[1]: Read complete after 0s [id=ea71dd91fbe9071a4ece7c3a41d5727b906e8792]
data.local_file.ssh-keygen[0]: Read complete after 0s [id=b08bc1103b1d8aa05f22be806d89df833d41503c]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # null_resource.ssh-keygen[0] will be destroyed
  - resource "null_resource" "ssh-keygen" {
      - id = "65923644069703909" -> null
    }

  # null_resource.ssh-keygen[1] will be destroyed
  - resource "null_resource" "ssh-keygen" {
      - id = "3802793460838414525" -> null
    }

Plan: 0 to add, 0 to change, 2 to destroy.

Changes to Outputs:
  - pub_keys = [
      - <<-EOT
            ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPY3dlM/S4EVCkVF7GgRyziJ4az/r2O0x5zP0IDRBaIgpjLqQQXaVE7BKzAOY9sS3DqeUT1KyfePP43ctEA2zmnoQVM1eI7w5XDRsxk9MrpvKanWnWOuq8gTj4/6HFOb3NTgZVte/hCM7XwxJmA6KVgAlk9axakmgC1OvPpFDZek+hBy4NpIP5UWGknSukQcZneXvbn2WoLebdZJ5TRCW8TdiLT+tpaeg2hwBH1y8uIyhQI3mdDydp2dYexiFi83bbADtxrOKBRxP12zrG7htUgaMZTxdeBMxDhv+MIbPxzDN0+B4iR6d0hKHTaH3cB7KARK+6mYhDG5vMhYzuodzWJoKLIDVRSQVVtZRs2Yx8bZKqNHcyGtfgEgMgwwlKWMW65fFscbEOcJMY1oEvv9vmKb8s3qI2mmVLYn6C63u6liX606t7vTyRjq21dXwJOPcNARJiAnwP4YPhROmK8g/9XTzHxBSP/EVUvbDRlgtKuqtxssf+RrosJk1LdpAHSTc= 
        EOT,
      - <<-EOT
            ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCXOa0wOsAV03DZ/IUlvGxROXOO6ugdFe3e+6y1yCJ7SuYe8WzJe20Fa/es8qV2e/CLoBEhUSimrjyS7bzY/NbdpBebGbHZRY87ols3JhnXNHjLC3RvBx0PoNd4wJUYwG0LNfdfSL6HYFXJfIVVi/bFgiJH9qiBAsZdHUEbuzVagQsaEQDdVOmdNy3vZ4A+Pz3wWLfIXctseFycl6Arrje73DQBzmCz/5qrtTES6YqGmjLQh9m0CIJRhlzKK5uyZ/OyGTLM3saybuPnQG2k57jBroko7bLZpbhNNx+jIE0PJTsi0uSYC2+3+V0sUhgaksAveN9XaUpHXm4XVa7IwH4EmMdViW2VNNashwkqp1M5p7B8Zy7U+CxtXc8ZhrTAYhTRefnSGK5gWslpBtQNFpA5p+Ius1enEGHfSmtP/LnnnzisylVgSUPLqKgYqMeWYiy5Q8fC2mR3Mr/T6PMnc4bfrOT6wzXsAOdqmkjtdJgZzOwjLmwKH4UPcsnM4e51kH8= 
        EOT,
    ] -> null
null_resource.ssh-keygen[1]: Destroying... [id=3802793460838414525]
null_resource.ssh-keygen[0]: Destroying... [id=65923644069703909]
null_resource.ssh-keygen[1]: Destruction complete after 0s
null_resource.ssh-keygen[0]: Destruction complete after 0s

Destroy complete! Resources: 2 destroyed.
```

```
$ ls id_rsa_*
id_rsa_node03  id_rsa_node03.pub  id_rsa_node04  id_rsa_node04.pub
```
local-execによるキー作成なので、destroyによってもキーファイルは削除されない。

### 再実行2
```
$ terraform apply --auto-approve 

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.local_file.ssh-keygen[0] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "local_file" "ssh-keygen" {
      + content        = (known after apply)
      + content_base64 = (known after apply)
      + filename       = "./id_rsa_node03.pub"
      + id             = (known after apply)
    }

  # data.local_file.ssh-keygen[1] will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "local_file" "ssh-keygen" {
      + content        = (known after apply)
      + content_base64 = (known after apply)
      + filename       = "./id_rsa_node04.pub"
      + id             = (known after apply)
    }

  # null_resource.ssh-keygen[0] will be created
  + resource "null_resource" "ssh-keygen" {
      + id = (known after apply)
    }

  # null_resource.ssh-keygen[1] will be created
  + resource "null_resource" "ssh-keygen" {
      + id = (known after apply)
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + pub_keys = [
      + (known after apply),
      + (known after apply),
    ]
null_resource.ssh-keygen[0]: Creating...
null_resource.ssh-keygen[1]: Creating...
null_resource.ssh-keygen[0]: Provisioning with 'local-exec'...
null_resource.ssh-keygen[0] (local-exec): Executing: ["/bin/sh" "-c" "ssh-keygen -m PEM  -C '' -N '' -f ./id_rsa_node03; exit 0"]
null_resource.ssh-keygen[1]: Provisioning with 'local-exec'...
null_resource.ssh-keygen[1] (local-exec): Executing: ["/bin/sh" "-c" "ssh-keygen -m PEM  -C '' -N '' -f ./id_rsa_node04; exit 0"]
null_resource.ssh-keygen[0] (local-exec): Generating public/private rsa key pair.
null_resource.ssh-keygen[0] (local-exec): ./id_rsa_node03 already exists.
null_resource.ssh-keygen[0] (local-exec): Overwrite (y/n)?
null_resource.ssh-keygen[0]: Creation complete after 0s [id=2920462168810969721]
null_resource.ssh-keygen[1] (local-exec): Generating public/private rsa key pair.
null_resource.ssh-keygen[1] (local-exec): ./id_rsa_node04 already exists.
null_resource.ssh-keygen[1] (local-exec): Overwrite (y/n)?
null_resource.ssh-keygen[1]: Creation complete after 0s [id=5240140531633316223]
data.local_file.ssh-keygen[0]: Reading...
data.local_file.ssh-keygen[1]: Reading...
data.local_file.ssh-keygen[1]: Read complete after 0s [id=ea71dd91fbe9071a4ece7c3a41d5727b906e8792]
data.local_file.ssh-keygen[0]: Read complete after 0s [id=b08bc1103b1d8aa05f22be806d89df833d41503c]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Outputs:

pub_keys = [
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPY3dlM/S4EVCkVF7GgRyziJ4az/r2O0x5zP0IDRBaIgpjLqQQXaVE7BKzAOY9sS3DqeUT1KyfePP43ctEA2zmnoQVM1eI7w5XDRsxk9MrpvKanWnWOuq8gTj4/6HFOb3NTgZVte/hCM7XwxJmA6KVgAlk9axakmgC1OvPpFDZek+hBy4NpIP5UWGknSukQcZneXvbn2WoLebdZJ5TRCW8TdiLT+tpaeg2hwBH1y8uIyhQI3mdDydp2dYexiFi83bbADtxrOKBRxP12zrG7htUgaMZTxdeBMxDhv+MIbPxzDN0+B4iR6d0hKHTaH3cB7KARK+6mYhDG5vMhYzuodzWJoKLIDVRSQVVtZRs2Yx8bZKqNHcyGtfgEgMgwwlKWMW65fFscbEOcJMY1oEvv9vmKb8s3qI2mmVLYn6C63u6liX606t7vTyRjq21dXwJOPcNARJiAnwP4YPhROmK8g/9XTzHxBSP/EVUvbDRlgtKuqtxssf+RrosJk1LdpAHSTc= 
  
  EOT,
  <<-EOT
  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCXOa0wOsAV03DZ/IUlvGxROXOO6ugdFe3e+6y1yCJ7SuYe8WzJe20Fa/es8qV2e/CLoBEhUSimrjyS7bzY/NbdpBebGbHZRY87ols3JhnXNHjLC3RvBx0PoNd4wJUYwG0LNfdfSL6HYFXJfIVVi/bFgiJH9qiBAsZdHUEbuzVagQsaEQDdVOmdNy3vZ4A+Pz3wWLfIXctseFycl6Arrje73DQBzmCz/5qrtTES6YqGmjLQh9m0CIJRhlzKK5uyZ/OyGTLM3saybuPnQG2k57jBroko7bLZpbhNNx+jIE0PJTsi0uSYC2+3+V0sUhgaksAveN9XaUpHXm4XVa7IwH4EmMdViW2VNNashwkqp1M5p7B8Zy7U+CxtXc8ZhrTAYhTRefnSGK5gWslpBtQNFpA5p+Ius1enEGHfSmtP/LnnnzisylVgSUPLqKgYqMeWYiy5Q8fC2mR3Mr/T6PMnc4bfrOT6wzXsAOdqmkjtdJgZzOwjLmwKH4UPcsnM4e51kH8= 
  
  EOT,
]
```

ssh-keygenが再実行されるが、Overwrite (y/n)?にyで応答しないので、上書きされない。
そのため、再実行時にも同じキーが使用される。