Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ssh key support #12

Merged
merged 3 commits into from
Aug 19, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add support to enable uploading public ssh key to IAM users
Callum Scott committed Jun 28, 2018
commit 360dfbc92f26ae86674a9f06419f5879d10e5498
6 changes: 6 additions & 0 deletions modules/iam-user/main.tf
Original file line number Diff line number Diff line change
@@ -21,3 +21,9 @@ resource "aws_iam_access_key" "this" {
user = "${aws_iam_user.this.name}"
pgp_key = "${var.pgp_key}"
}

resource "aws_iam_user_ssh_key" "this" {
username = "${aws_iam_user.this.name}"
encoding = "${var.ssh_key_encoding}"
public_key = "${var.ssh_public_key}"
}
4 changes: 4 additions & 0 deletions modules/iam-user/outputs.tf
Original file line number Diff line number Diff line change
@@ -86,3 +86,7 @@ ${element(concat(aws_iam_access_key.this.*.encrypted_secret, list("")), 0)}
-----END PGP MESSAGE-----
EOF
}

output "this_iam_ssh_public_key_id" {
value = "SSH Key ID: ${element(concat(aws_iam_user_ssh_key.this.*.ssh_public_key_id, list("")), 0)}"
}
10 changes: 10 additions & 0 deletions modules/iam-user/variables.tf
Original file line number Diff line number Diff line change
@@ -41,3 +41,13 @@ variable "password_length" {
description = "The length of the generated password"
default = 20
}


variable "ssh_key_encoding" {
description = "Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM"
default = "SSH"
}

variable "ssh_public_key" {
description = "Public SSH key"
}