<commit_before># key-pair

This is a Terraform module to create a key-pair in the current account which can be used when  
starting a standalone EC2 instances or as part of the Auto-Scaling Group launch configuration.

By default, this module creates both the public and private keys automatically, and derives  
name of the key-pair to be created from the `stack_name` variable. An existing public key in  
the OpenSSH public key format can be provided using the `public_key` variable, whereas the  
key-pair name can be overridden using the `key_name` variable.

## Requirements

- Terraform 0.10.x or higher;
- Bash 4.0 or higher;
- jq 1.5 or higher.

This module requires a Bash shell and jq for its helper script, and assumes that the jq binary  
is available from within the current environment.

## Dependencies

None.

## Usage

#### Example of a key-pair with public and private keys created automatically:

```ruby
module "example_key_pair" {
  source = "./key-pair"

  stack_name = "example-stack"
}
```

#### Example of a key-pair with an existing public key and a custom key-pair name:

```ruby
module "jenkins_key_pair" {
  source = "./key-pair"

  stack_name = "example-stack"
  public_key = "./example/id_rsa.pub"<commit_msg>Update README.md file.<commit_after># key-pair

This is a Terraform module to create a key-pair in the current account which can be used when  
starting a standalone EC2 instances or as part of the Auto-Scaling Group launch configuration.

By default, this module creates both the public and private keys automatically, and derives  
name of the key-pair to be created from the `stack_name` variable. An existing public key in  
the OpenSSH public key format can be provided using the `public_key` variable, whereas the  
key-pair name can be overridden using the `key_name` variable.

## Requirements

- Terraform 0.10.x or higher;
- Bash 4.0 or higher;
- jq 1.5 or higher.

This module requires a Bash shell and jq for its helper script, and assumes that the jq binary  
is available from within the current environment.

## Dependencies

None.

## Usage

#### Example of a key-pair with public and private keys created automatically:

```ruby
module "example_key_pair" {
  source = "./key-pair"

  stack_name = "example-stack"
}
```

#### Example of a key-pair using public key given as an inline value and a custom key-pair name:

```ruby
module "deploy_key_pair" {
  source = "./key-pair"

  stack_name = "example-stack"
  public_key = "ssh-rsa AAAAB3NzaC1 (...)"
  key_name   = "deploy"
}
```

#### Example of a key-pair with an existing public key and a custom key-pair name:

```ruby
module "jenkins_key_pair" {
  source = "./key-pair"

  stack_name = "example-stack"
  public_key = "./example/id_rsa.pub"
{'fraction_non_alphanumeric': 0.08460421205519245, 'fraction_numerical': 0.006535947712418301, 'mean_word_length': 3.8333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1857340', 'n_tokens_mistral': 856, 'n_tokens_neox': 807, 'n_words': 368}