0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-01 02:52:58 +00:00

chore(docs): minor improvements around SSH private key usage (#1091)

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2024-03-04 19:57:37 -05:00 committed by GitHub
parent 85705fdd51
commit 171dd2f234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,22 +121,24 @@ The SSH agent authentication takes precedence over the `private_key` and `passwo
In some cases where SSH agent is not available, for example when running Terraform from a Windows machine, or when using a CI/CD pipeline that does not support SSH agent forwarding, In some cases where SSH agent is not available, for example when running Terraform from a Windows machine, or when using a CI/CD pipeline that does not support SSH agent forwarding,
you can use the `private_key` argument in the `ssh` block (or alternatively `PROXMOX_VE_SSH_PRIVATE_KEY` environment variable) to provide the private key for the SSH connection. you can use the `private_key` argument in the `ssh` block (or alternatively `PROXMOX_VE_SSH_PRIVATE_KEY` environment variable) to provide the private key for the SSH connection.
The private key must be in PEM format, and can be loaded from a file: The private key mut not be encrypted, and must be in PEM format.
You can provide the private key from a file:
```terraform ```terraform
provider "proxmox" { provider "proxmox" {
... // ...
ssh { ssh {
agent = false agent = false
private_key = file("~/.ssh/id_rsa") private_key = file("~/.ssh/id_rsa")
} }
} }
``` ```
Not recommended, but you can also use a heredoc syntax to provide the private key as a string (note that the private key content must not be indented):
Alternatively, although not recommended due to the increased risk of exposing an unprotected key, heredoc syntax can be used to supply the private key as a string.
Note that the content of the private key must not be indented:
```terraform ```terraform
provider "proxmox" { provider "proxmox" {
... // ...
ssh { ssh {
agent = false agent = false
@ -146,6 +148,7 @@ b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
<SKIPPED> <SKIPPED>
DMUWUEaH7yMCKl7uCZ9xAAAAAAECAwQF DMUWUEaH7yMCKl7uCZ9xAAAAAAECAwQF
-----END OPENSSH PRIVATE KEY----- -----END OPENSSH PRIVATE KEY-----
EOF
} }
} }
``` ```
@ -157,7 +160,7 @@ This can be overridden by specifying the `username` argument in the `ssh` block
```terraform ```terraform
provider "proxmox" { provider "proxmox" {
... // ...
ssh { ssh {
agent = true agent = true