{"id":13930017,"url":"https://github.com/peterpramb/terraform-hcloud-ssh-keys","last_synced_at":"2025-07-19T12:31:19.891Z","repository":{"id":135391800,"uuid":"303005170","full_name":"peterpramb/terraform-hcloud-ssh-keys","owner":"peterpramb","description":"Terraform module for managing SSH keys in the Hetzner Cloud","archived":false,"fork":false,"pushed_at":"2022-08-14T12:28:09.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-08T18:25:46.160Z","etag":null,"topics":["hetzner-cloud","hetzner-cloud-ssh-keys","terraform-module"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterpramb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-10-10T23:10:03.000Z","updated_at":"2022-08-14T12:25:29.000Z","dependencies_parsed_at":"2024-01-17T05:26:50.730Z","dependency_job_id":"ce3a8d1d-7b7a-41d2-8ee9-5e42b0978d27","html_url":"https://github.com/peterpramb/terraform-hcloud-ssh-keys","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterpramb%2Fterraform-hcloud-ssh-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterpramb%2Fterraform-hcloud-ssh-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterpramb%2Fterraform-hcloud-ssh-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterpramb%2Fterraform-hcloud-ssh-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterpramb","download_url":"https://codeload.github.com/peterpramb/terraform-hcloud-ssh-keys/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226607582,"owners_count":17658477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hetzner-cloud","hetzner-cloud-ssh-keys","terraform-module"],"created_at":"2024-08-07T18:02:40.899Z","updated_at":"2024-11-26T19:30:45.536Z","avatar_url":"https://github.com/peterpramb.png","language":"HCL","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"[![License](https://img.shields.io/github/license/peterpramb/terraform-hcloud-ssh-keys)](https://github.com/peterpramb/terraform-hcloud-ssh-keys/blob/master/LICENSE)\n[![Latest Release](https://img.shields.io/github/v/release/peterpramb/terraform-hcloud-ssh-keys?sort=semver)](https://github.com/peterpramb/terraform-hcloud-ssh-keys/releases/latest)\n[![Terraform Version](https://img.shields.io/badge/terraform-%E2%89%A5%200.13.0-623ce4)](https://www.terraform.io)\n\n\n# terraform-hcloud-ssh-keys\n\n[Terraform](https://www.terraform.io) module for managing SSH keys in the [Hetzner Cloud](https://www.hetzner.com/cloud), with support for generating new SSH keys and importing existing SSH public keys.\n\nIt implements the following [provider](#providers) resources:\n\n- [hcloud\\_ssh\\_key](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/ssh_key)\n- [local\\_file](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file)\n- [local\\_sensitive\\_file](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file)\n- [tls\\_private\\_key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key)\n\n:warning: **WARNING**: SSH private keys will be stored unencrypted in the [Terraform state](https://www.terraform.io/docs/state). Using generated SSH keys in production deployments is therefore not recommended. Instead, create and distribute SSH keys outside of Terraform and just import the SSH public keys into Terraform.\n\n\n## Usage\n\n```terraform\nmodule \"ssh_key\" {\n  source   = \"github.com/peterpramb/terraform-hcloud-ssh-keys?ref=\u003crelease\u003e\"\n\n  ssh_keys = [\n    {\n      name       = \"ssh-gen-1\"\n      algorithm  = \"ECDSA\"\n      key_param  = \"P256\"\n      public_key = null\n      labels     = {\n        \"managed\"    = \"true\"\n        \"managed_by\" = \"Terraform\"\n      }\n    },\n    {\n      name       = \"ssh-gen-2\"\n      algorithm  = \"RSA\"\n      key_param  = \"4096\"\n      public_key = null\n      labels     = {\n        \"managed\"    = \"true\"\n        \"managed_by\" = \"Terraform\"\n      }\n    },\n    {\n      name       = \"ssh-imp-1\"\n      algorithm  = null\n      key_param  = null\n      public_key = \"~/.ssh/cloud-infra.pub\"\n      labels     = {\n        \"managed\"    = \"true\"\n        \"managed_by\" = \"Terraform\"\n      }\n    },\n    {\n      name       = \"ssh-imp-2\"\n      algorithm  = null\n      key_param  = null\n      public_key = \"ecdsa-sha2-nistp256 AAAAE2VjZH...\"\n      labels     = {\n        \"managed\"    = \"true\"\n        \"managed_by\" = \"Terraform\"\n      }\n    }\n  ]\n}\n```\n\n\n## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](https://www.terraform.io) | \u0026ge; 0.13 |\n\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [hcloud](https://registry.terraform.io/providers/hetznercloud/hcloud) | \u0026ge; 1.20 |\n| [local](https://registry.terraform.io/providers/hashicorp/local) | \u0026ge; 2.2 |\n| [tls](https://registry.terraform.io/providers/hashicorp/tls) | \u0026ge; 2.1 |\n\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|:----:|:-------:|:--------:|\n| ssh\\_keys | List of SSH key objects to be managed. | list(map([*ssh\\_key*](#ssh_key))) | See [below](#defaults) | yes |\n| ssh\\_key\\_path | Destination path for generated SSH key files. | string | `\"~/.ssh\"` | no |\n| ssh\\_key\\_path\\_perms | Permissions for the SSH key destination path. | string | `\"0700\"` | no |\n| ssh\\_private\\_key\\_perms | Permissions for generated SSH private key files. | string | `\"0600\"` | no |\n| ssh\\_public\\_key\\_perms | Permissions for generated SSH public key files. | string | `\"0640\"` | no |\n\n\n#### *ssh\\_key*\n\n| Name | Description | Type | Required |\n|------|-------------|:----:|:--------:|\n| [name](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/ssh_key#name) | Unique name of the SSH key. | string | yes |\n| [algorithm](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key#algorithm) | Key algorithm for generated SSH keys. | string | yes (generate only) |\n| key\\_param | [RSA key size](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key#rsa_bits) or [elliptic curve name](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key#ecdsa_curve). | string | no |\n| [public\\_key](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/ssh_key#public_key) | Absolute path to SSH public key file or SSH public key data. | string | yes (import only) |\n| [labels](https://registry.terraform.io/providers/hetznercloud/hcloud/latest/docs/resources/ssh_key#labels) | Map of user-defined labels. | map(string) | no |\n\n\n### Defaults\n\n```terraform\nssh_keys = [\n  {\n    name       = \"ssh-key-1\"\n    algorithm  = null\n    key_param  = null\n    public_key = \"~/.ssh/id_rsa.pub\"\n    labels     = {}\n  }\n]\n```\n\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| ssh\\_keys | List of all SSH key objects. |\n| ssh\\_key\\_ids | Map of all SSH key objects indexed by ID. |\n| ssh\\_key\\_names | Map of all SSH key objects indexed by name. |\n\n\n### Defaults\n\n```terraform\nssh_keys = [\n  {\n    \"fingerprint\" = \"32:1e:71:8f:03:34...\"\n    \"id\" = \"2173651\"\n    \"labels\" = {}\n    \"name\" = \"ssh-key-1\"\n    \"public_key\" = \"ssh-rsa AAAAB3NzaC...\"\n  },\n]\n\nssh_key_ids = {\n  \"2173651\" = {\n    \"fingerprint\" = \"32:1e:71:8f:03:34...\"\n    \"id\" = \"2173651\"\n    \"labels\" = {}\n    \"name\" = \"ssh-key-1\"\n    \"public_key\" = \"ssh-rsa AAAAB3NzaC...\"\n  }\n}\n\nssh_key_names = {\n  \"ssh-key-1\" = {\n    \"fingerprint\" = \"32:1e:71:8f:03:34...\"\n    \"id\" = \"2173651\"\n    \"labels\" = {}\n    \"name\" = \"ssh-key-1\"\n    \"public_key\" = \"ssh-rsa AAAAB3NzaC...\"\n  }\n}\n```\n\n\n## License\n\nThis module is released under the [MIT](https://github.com/peterpramb/terraform-hcloud-ssh-keys/blob/master/LICENSE) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterpramb%2Fterraform-hcloud-ssh-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterpramb%2Fterraform-hcloud-ssh-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterpramb%2Fterraform-hcloud-ssh-keys/lists"}