Skip to content

Commit

Permalink
feat: Add function to support SSH keys based on file or text (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoppe authored Jan 15, 2022
1 parent 1a8bd14 commit 570fdef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Terraform module to manage the Hetzner Cloud resource (hcloud_ssh_key).

Copy and paste into your Terraform configuration, insert the variables and run ```terraform init```:

**Provide SSH key as file:**

```hcl
module "hcloud-ssh_key" {
source = "dhoppeIT/ssh_key/hcloud"
Expand All @@ -19,6 +21,17 @@ module "hcloud-ssh_key" {
}
```

**Provide SSH key as text:**

```hcl
module "hcloud-ssh_key" {
source = "dhoppeIT/ssh_key/hcloud"
name = "terraform"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3euXiX6jFStmjcDzW4dHZSdSUuip3cGu62Fhh0+zdILdzvyoMwqeuuuWova+ltZfeAgZOd6n0QKOhs2eTj6eEfTyIpmmCQgosu1GyQKQ8oHcBqDV+atrc2MQRhZPIZgVXn4CL8IldlEjYoGI6zreBY1uEhUoGC79bt9Eqtmxr1M8xQmJ1ZVI8kzDLax31vckuWnO3PlaUyT5VPBC/XPLdZ3PodX7J2CQ0MwlHzG1qFxrp1XonYpV1Rbfb9Vj4Wu27Md7RETSOZq7wlsgEC7MBTb6guFuz4tL5CfiHO3YhZEmtWi5UL7YMuP4pD+mGU3nKcQOsOYNpuzV5p7NZANv+i40BtSJiQCWbzrPAOvj8Pn5lk/7aE3uVRHAWpIwGJ3HAof9VS5EoM2oq6dwAM8bK/XBz77pOdyHv+89o3Rc/WzhBs5wSMHUd54SQZ4STEERmi/GWUcfYi30s01W2SmH3H02NI8iPfNvDma858CfwDELNJnE7rphG1INQSZArSzpTZpoHFPZ0pIvG7mFMKeYmjizV8W9TwS+IpuLR6Cm3plUIhQhAzbyeVVKAU+66DtywIKdJm20Y94joVQD3KOGlxUrqKwyTZAOkknR7/yKiQfgritlRKVdLHyW/znBKCHskwqp9WgXBP6q4YvfM3muWK+guj+wi+9CtjNUYT+tkRQ== Terraform"
}
```

<!--- BEGIN_TF_DOCS --->
## Requirements

Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "hcloud_ssh_key" "default" {
name = var.name
public_key = file("${var.public_key}")
public_key = fileexists("${var.public_key}") ? file("${var.public_key}") : var.public_key
}

0 comments on commit 570fdef

Please sign in to comment.