{"id":14957890,"url":"https://github.com/terraform-aws-modules/terraform-aws-key-pair","last_synced_at":"2025-04-04T09:08:49.081Z","repository":{"id":45081353,"uuid":"210869559","full_name":"terraform-aws-modules/terraform-aws-key-pair","owner":"terraform-aws-modules","description":"Terraform module to create AWS EC2 key pair resources 🇺🇦","archived":false,"fork":false,"pushed_at":"2024-10-11T16:06:39.000Z","size":57,"stargazers_count":83,"open_issues_count":0,"forks_count":131,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T08:09:08.003Z","etag":null,"topics":["aws","aws-ec2","ec2-key-pair","key-pair","terraform-module"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-aws-modules/key-pair/aws","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraform-aws-modules.png","metadata":{"funding":{"github":["antonbabenko"],"custom":"https://www.paypal.me/antonbabenko"},"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-25T14:45:59.000Z","updated_at":"2025-03-13T14:21:53.000Z","dependencies_parsed_at":"2024-12-13T15:10:09.948Z","dependency_job_id":"727ba4f8-8bde-409b-9ee9-22e93e01b8d2","html_url":"https://github.com/terraform-aws-modules/terraform-aws-key-pair","commit_stats":{"total_commits":38,"total_committers":6,"mean_commits":6.333333333333333,"dds":0.631578947368421,"last_synced_commit":"cb143fb0d5341b974926a678a0b6e3a75d0afc06"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-key-pair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-key-pair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-key-pair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-aws-modules%2Fterraform-aws-key-pair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-aws-modules","download_url":"https://codeload.github.com/terraform-aws-modules/terraform-aws-key-pair/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"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":["aws","aws-ec2","ec2-key-pair","key-pair","terraform-module"],"created_at":"2024-09-24T13:15:46.619Z","updated_at":"2025-04-04T09:08:49.057Z","avatar_url":"https://github.com/terraform-aws-modules.png","language":"HCL","funding_links":["https://github.com/sponsors/antonbabenko","https://www.paypal.me/antonbabenko"],"categories":[],"sub_categories":[],"readme":"# AWS Key Pair Terraform module\n\nTerraform module which creates EC2 key pair on AWS.\n\n[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n\n## Usage\n\n### EC2 Key pair w/ module created key material\n\n```hcl\nmodule \"key_pair\" {\n  source = \"terraform-aws-modules/key-pair/aws\"\n\n  key_name           = \"deployer-one\"\n  create_private_key = true\n}\n```\n\n### EC2 Key pair w/ externally created public key material\n\n```hcl\nresource \"tls_private_key\" \"this\" {\n  algorithm = \"RSA\"\n}\n\nmodule \"key_pair\" {\n  source = \"terraform-aws-modules/key-pair/aws\"\n\n  key_name   = \"deployer-two\"\n  public_key = trimspace(tls_private_key.this.public_key_openssh)\n}\n```\n\n### EC2 Key pair w/ existing public key material\n\n```hcl\nmodule \"key_pair\" {\n  source = \"terraform-aws-modules/key-pair/aws\"\n\n  key_name   = \"deployer-three\"\n  public_key = \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com\"\n}\n```\n\n## Conditional creation\n\nSometimes you need to have a way to create key pair conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_key_pair`.\n\n```hcl\n# This EC2 key pair will not be created\nmodule \"key_pair\" {\n  source = \"terraform-aws-modules/key-pair/aws\"\n\n  create = false\n  # ... omitted\n}\n```\n\n## Examples:\n\n- [Complete](https://github.com/terraform-aws-modules/terraform-aws-key-pair/tree/master/examples/complete) - Create EC2 key pair\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e= 1.0 |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | \u003e= 4.21 |\n| \u003ca name=\"requirement_tls\"\u003e\u003c/a\u003e [tls](#requirement\\_tls) | \u003e= 3.4 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_aws\"\u003e\u003c/a\u003e [aws](#provider\\_aws) | \u003e= 4.21 |\n| \u003ca name=\"provider_tls\"\u003e\u003c/a\u003e [tls](#provider\\_tls) | \u003e= 3.4 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_key_pair.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair) | resource |\n| [tls_private_key.this](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_create\"\u003e\u003c/a\u003e [create](#input\\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |\n| \u003ca name=\"input_create_private_key\"\u003e\u003c/a\u003e [create\\_private\\_key](#input\\_create\\_private\\_key) | Determines whether a private key will be created | `bool` | `false` | no |\n| \u003ca name=\"input_key_name\"\u003e\u003c/a\u003e [key\\_name](#input\\_key\\_name) | The name for the key pair. Conflicts with `key_name_prefix` | `string` | `null` | no |\n| \u003ca name=\"input_key_name_prefix\"\u003e\u003c/a\u003e [key\\_name\\_prefix](#input\\_key\\_name\\_prefix) | Creates a unique name beginning with the specified prefix. Conflicts with `key_name` | `string` | `null` | no |\n| \u003ca name=\"input_private_key_algorithm\"\u003e\u003c/a\u003e [private\\_key\\_algorithm](#input\\_private\\_key\\_algorithm) | Name of the algorithm to use when generating the private key. Currently-supported values are `RSA` and `ED25519` | `string` | `\"RSA\"` | no |\n| \u003ca name=\"input_private_key_rsa_bits\"\u003e\u003c/a\u003e [private\\_key\\_rsa\\_bits](#input\\_private\\_key\\_rsa\\_bits) | When algorithm is `RSA`, the size of the generated RSA key, in bits (default: `4096`) | `number` | `4096` | no |\n| \u003ca name=\"input_public_key\"\u003e\u003c/a\u003e [public\\_key](#input\\_public\\_key) | The public key material | `string` | `\"\"` | no |\n| \u003ca name=\"input_tags\"\u003e\u003c/a\u003e [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_key_pair_arn\"\u003e\u003c/a\u003e [key\\_pair\\_arn](#output\\_key\\_pair\\_arn) | The key pair ARN |\n| \u003ca name=\"output_key_pair_fingerprint\"\u003e\u003c/a\u003e [key\\_pair\\_fingerprint](#output\\_key\\_pair\\_fingerprint) | The MD5 public key fingerprint as specified in section 4 of RFC 4716 |\n| \u003ca name=\"output_key_pair_id\"\u003e\u003c/a\u003e [key\\_pair\\_id](#output\\_key\\_pair\\_id) | The key pair ID |\n| \u003ca name=\"output_key_pair_name\"\u003e\u003c/a\u003e [key\\_pair\\_name](#output\\_key\\_pair\\_name) | The key pair name |\n| \u003ca name=\"output_private_key_id\"\u003e\u003c/a\u003e [private\\_key\\_id](#output\\_private\\_key\\_id) | Unique identifier for this resource: hexadecimal representation of the SHA1 checksum of the resource |\n| \u003ca name=\"output_private_key_openssh\"\u003e\u003c/a\u003e [private\\_key\\_openssh](#output\\_private\\_key\\_openssh) | Private key data in OpenSSH PEM (RFC 4716) format |\n| \u003ca name=\"output_private_key_pem\"\u003e\u003c/a\u003e [private\\_key\\_pem](#output\\_private\\_key\\_pem) | Private key data in PEM (RFC 1421) format |\n| \u003ca name=\"output_public_key_fingerprint_md5\"\u003e\u003c/a\u003e [public\\_key\\_fingerprint\\_md5](#output\\_public\\_key\\_fingerprint\\_md5) | The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:....` Only available if the selected private key format is compatible, similarly to `public_key_openssh` and the ECDSA P224 limitations |\n| \u003ca name=\"output_public_key_fingerprint_sha256\"\u003e\u003c/a\u003e [public\\_key\\_fingerprint\\_sha256](#output\\_public\\_key\\_fingerprint\\_sha256) | The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. `SHA256:....` Only available if the selected private key format is compatible, similarly to `public_key_openssh` and the ECDSA P224 limitations |\n| \u003ca name=\"output_public_key_openssh\"\u003e\u003c/a\u003e [public\\_key\\_openssh](#output\\_public\\_key\\_openssh) | The public key data in \"Authorized Keys\" format. This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys |\n| \u003ca name=\"output_public_key_pem\"\u003e\u003c/a\u003e [public\\_key\\_pem](#output\\_public\\_key\\_pem) | Public key data in PEM (RFC 1421) format |\n\u003c!-- END_TF_DOCS --\u003e\n\n## Authors\n\nModule is maintained by [Anton Babenko](https://github.com/antonbabenko) with help from [these awesome contributors](https://github.com/terraform-aws-modules/terraform-aws-key-pair/graphs/contributors).\n\n## License\n\nApache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-key-pair/tree/master/LICENSE) for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-key-pair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-key-pair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-aws-modules%2Fterraform-aws-key-pair/lists"}