diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe0201..5704eba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.1.2 + +ENHANCEMENTS: + +* Output the private key path. + # 0.1.1 BUG FIXES: diff --git a/README.md b/README.md index 2dbfeb8..cf8b07b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/input.tf b/input.tf index bb68347..d3934bf 100644 --- a/input.tf +++ b/input.tf @@ -1,4 +1,4 @@ variable "path" { - default = "~/.ssh/id_rsa" + default = "~/.ssh/id_rsa" description = "Path to the private SSH key." } diff --git a/main.tf b/main.tf index 56a85cd..e63edb1 100644 --- a/main.tf +++ b/main.tf @@ -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" { diff --git a/output.tf b/output.tf index 29a103c..cb8631e 100644 --- a/output.tf +++ b/output.tf @@ -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}" +}