-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Update supported versions and add support for private key crea…
…tion (#25)
- Loading branch information
1 parent
a03b1fb
commit cd5ebdb
Showing
12 changed files
with
428 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Upgrade from v1.x to v2.x | ||
|
||
Please consult the `examples` directory for reference example configurations. If you find a bug, please open an issue with supporting configuration to reproduce. | ||
|
||
## List of backwards incompatible changes | ||
|
||
- Minimum supported version of Terraform AWS provider updated to v4.21 to support latest resources | ||
- Minimum supported version of Terraform updated to v1.0 | ||
- The variable `create_key_pair` is now simply `create` | ||
|
||
## Additional changes | ||
|
||
### Added | ||
|
||
- Support for creating private key within the module using the commonly used `tls_private_key` resource | ||
|
||
### Modified | ||
|
||
- None | ||
|
||
### Removed | ||
|
||
- None | ||
|
||
### Variable and output changes | ||
|
||
1. Removed variables: | ||
|
||
- None | ||
|
||
2. Renamed variables: | ||
|
||
- `create_key_pair` -> `create` | ||
|
||
3. Added variables: | ||
|
||
- `create_private_key` | ||
- `private_key_algorithm` | ||
- `private_key_rsa_bits` | ||
|
||
4. Removed outputs: | ||
|
||
- None | ||
|
||
5. Renamed outputs: | ||
|
||
- `key_pair_key_pair_id` -> `key_pair_id` | ||
- `key_pair_key_name` -> `key_pair_name` | ||
|
||
|
||
6. Added outputs: | ||
|
||
- `key_pair_arn` | ||
- `private_key_id` | ||
- `private_key_openssh` | ||
- `private_key_pem` | ||
- `public_key_fingerprint_md5` | ||
- `public_key_fingerprint_sha256` | ||
- `public_key_openssh` | ||
- `public_key_pem` | ||
|
||
## Upgrade Migrations | ||
|
||
### State Move Commands | ||
|
||
None required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Examples | ||
|
||
Please note - the examples provided serve two primary means: | ||
|
||
1. Show users working examples of the various ways in which the module can be configured and features supported | ||
2. A means of testing/validating module changes | ||
|
||
Please do not mistake the examples provided as "best practices". It is up to users to consult the AWS service documentation for best practices, usage recommendations, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,50 @@ | ||
resource "random_pet" "this" { | ||
length = 2 | ||
provider "aws" { | ||
region = local.region | ||
} | ||
|
||
resource "tls_private_key" "this" { | ||
algorithm = "RSA" | ||
locals { | ||
name = "ex-${replace(basename(path.cwd), "_", "-")}" | ||
region = "eu-west-1" | ||
|
||
tags = { | ||
Example = local.name | ||
GithubRepo = "terraform-aws-key-pair" | ||
GithubOrg = "terraform-aws-modules" | ||
} | ||
} | ||
|
||
################################################################################ | ||
# Key Pair Module | ||
################################################################################ | ||
|
||
module "key_pair" { | ||
source = "../../" | ||
|
||
key_name = random_pet.this.id | ||
public_key = tls_private_key.this.public_key_openssh | ||
key_name = local.name | ||
create_private_key = true | ||
|
||
tags = { | ||
Terraform = "<3" | ||
} | ||
tags = local.tags | ||
} | ||
|
||
module "key_pair_external" { | ||
source = "../../" | ||
|
||
key_name = "${random_pet.this.id}-external" | ||
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" | ||
key_name = "${local.name}-external" | ||
public_key = trimspace(tls_private_key.this.public_key_openssh) | ||
|
||
tags = { | ||
External = "yes" | ||
} | ||
tags = local.tags | ||
} | ||
|
||
module "key_pair_disabled" { | ||
source = "../../" | ||
|
||
create = false | ||
} | ||
|
||
################################################################################ | ||
# Supporting Resources | ||
################################################################################ | ||
|
||
resource "tls_private_key" "this" { | ||
algorithm = "RSA" | ||
} |
Oops, something went wrong.