Skip to content

Commit

Permalink
Expose the private key path
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunde committed Jun 28, 2018
1 parent 8e5450f commit 6072a59
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.1.2

ENHANCEMENTS:

* Output the private key path.

# 0.1.1

BUG FIXES:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resource "aws_instance" "instance" {
| Name | Description | Type |
|------|-------------|:----:|
| name | The AWS key name | string |
| private_key_path | Where the private key is located | string |

## License

Expand Down
2 changes: 1 addition & 1 deletion input.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "path" {
default = "~/.ssh/id_rsa"
default = "~/.ssh/id_rsa"
description = "Path to the private SSH key."
}
6 changes: 5 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
locals {
"private_key_path" = "${pathexpand(var.path)}"
}

data "external" "external" {
program = ["${join("", list(path.module, "/generate.sh"))}", "${pathexpand(var.path)}"]
program = ["${join("", list(path.module, "/generate.sh"))}", "${local.private_key_path}"]
}

resource "aws_key_pair" "key" {
Expand Down
6 changes: 5 additions & 1 deletion output.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
output "name" {
value = "${aws_key_pair.key.key_name}"
value = "${aws_key_pair.key.key_name}"
description = "The name of the key."
}

output "private_key_path" {
value = "${local.private_key_path}"
}

0 comments on commit 6072a59

Please sign in to comment.