Skip to content

Commit

Permalink
Upgrade for terraform 0.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunde committed Nov 13, 2020
1 parent 6072a59 commit 2906e11
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.0

* Upgraded to support terraform >= 0.13

# 0.1.2

ENHANCEMENTS:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ Simplest way of putting a SSH key pair on AWS.

# Usage


```hcl
module "key" {
source = "mediapop/key/aws"
}
resource "aws_instance" "instance" {
key_name = "${module.key.name}"
key_name = module.key.name
// ...
}
```
Expand Down
4 changes: 4 additions & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
provider "aws" {
region = "ap-southeast-1"
}

module "key" {
source = "../../"
}
4 changes: 4 additions & 0 deletions input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ variable "path" {
default = "~/.ssh/id_rsa"
description = "Path to the private SSH key."
}

locals {
private_key_path = pathexpand(var.path)
}
8 changes: 2 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
locals {
"private_key_path" = "${pathexpand(var.path)}"
}

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

resource "aws_key_pair" "key" {
public_key = "${data.external.external.result.public_key}"
public_key = data.external.external.result.public_key
}
4 changes: 2 additions & 2 deletions output.tf
Original file line number Diff line number Diff line change
@@ -1,8 +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}"
value = local.private_key_path
}
11 changes: 11 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
external = {
source = "hashicorp/external"
}
}
required_version = ">= 0.13"
}

0 comments on commit 2906e11

Please sign in to comment.