https://github.com/mitchellh/terraform-aws-dynamic-keys
Terraform module that dynamically generates a public/private keypair.
https://github.com/mitchellh/terraform-aws-dynamic-keys
Last synced: about 1 year ago
JSON representation
Terraform module that dynamically generates a public/private keypair.
- Host: GitHub
- URL: https://github.com/mitchellh/terraform-aws-dynamic-keys
- Owner: mitchellh
- Created: 2018-04-06T17:19:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-26T02:10:23.000Z (about 5 years ago)
- Last Synced: 2025-04-10T05:59:26.677Z (about 1 year ago)
- Language: HCL
- Homepage: https://registry.terraform.io/modules/mitchellh/dynamic-keys/
- Size: 6.84 KB
- Stars: 26
- Watchers: 4
- Forks: 25
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AWS Dynamic Keypair
========================
This Terraform module dynamically generates an SSH key pair, imports it
into AWS, and provides the keypair via outputs.
This can be used to create AWS resources with a keypair that doesn't have
to exist prior to the Terraform run. This is great for demos! Warning that
the private key information will be in the Terraform state, so this isn't
well suited currently for production environments.
What This Module Does
---------------------
Features:
* Creates a public/private keypair.
* Writes the keypair into files (optional).
* Imports the keypair into AWS.
* Provides the OpenSSH-formatted public key and a PEM-encoded private
key as output values that can be used directly with `connection` blocks.
Usage
-----
Run `terraform apply` against the example configuration below:
```hcl
provider "aws" {
version = "~> 1.0.0"
region = "us-west-2"
}
module "keypair" {
source = "mitchellh/dynamic-keys/aws"
path = "${path.root}/keys"
}
output "private_key_pem" {
value = "${module.keypair.private_key_pem}"
}
```
The SSH keys created are also in the `./keys` subdirectory relative to
the root Terraform configuration if you need those for any other reason.
These keys will be automatically deleted and removed when your configuration
is destroyed (via `terraform destroy`).
Terraform version
-----------------
Terraform version 0.11.0 or newer is required for this version to work.