-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Terraform TLS SSH key pair to SSM initial implementation #2
Conversation
LICENSE
Outdated
@@ -186,7 +186,7 @@ | |||
same "printed page" as the copyright notice for easier | |||
identification within third-party archives. | |||
|
|||
Copyright [yyyy] [name of copyright owner] | |||
Copyright 2018 Cloud Posse, LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2018 Cloud Posse, LLC | |
Copyright 2019 Cloud Posse, LLC |
main.tf
Outdated
name = "${local.ssh_private_key_ssm_path}" | ||
description = "TLS Private Key" | ||
type = "SecureString" | ||
value = "${tls_private_key.default_rsa.private_key_pem}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "${tls_private_key.default_rsa.private_key_pem}" | |
value = "${join("", tls_private_key.default_rsa.*.private_key_pem)}" |
main.tf
Outdated
name = "${local.ssh_public_key_ssm_path}" | ||
description = "TLS Public Key (OpenSSH - ${var.ssh_key_algorithm})" | ||
type = "String" | ||
value = "${tls_private_key.default_rsa.public_key_openssh}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "${tls_private_key.default_rsa.public_key_openssh}" | |
value = "${join("", tls_private_key.default_rsa.*.public_key_openssh)}" |
main.tf
Outdated
name = "${local.ssh_private_key_ssm_path}" | ||
description = "TLS Private Key (${var.ssh_key_algorithm})" | ||
type = "SecureString" | ||
value = "${tls_private_key.default_ecdsa.private_key_pem}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "${tls_private_key.default_ecdsa.private_key_pem}" | |
value = "${join("", tls_private_key.default_ecdsa.*.private_key_pem)}" |
main.tf
Outdated
name = "${local.ssh_public_key_ssm_path}" | ||
description = "TLS Public Key (${var.ssh_key_algorithm})" | ||
type = "String" | ||
value = "${tls_private_key.default_ecdsa.public_key_openssh}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "${tls_private_key.default_ecdsa.public_key_openssh}" | |
value = "${join("", tls_private_key.default_ecdsa.*.public_key_openssh)}" |
variables.tf
Outdated
@@ -0,0 +1,73 @@ | |||
variable "namespace" { | |||
type = "string" | |||
description = "Namespace (e.g. `cp` or `cloudposse`)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description = "Namespace (e.g. `cp` or `cloudposse`)" | |
description = "Namespace (e.g. `eg` or `cp`)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
@aknysh Have rebased and pushed requested changes, thanks! |
@osterman KMS key added and rebased |
19df679
to
a0b3d84
Compare
This commit adds some default variables and locals for naming of SSM params. We expect SSM params to be written in the form `/foo/bar` or `/foo/bar_badger` where foo is var.ssm_path_prefix and bar is passed in explicitly, or else we default to label.id where we replace the delimiter with underscores to maintain consistency. Both RSA + ECDSA key algo’s are supported.
what
This PR is an initial implementation for writing SSH keys to AWS SSM parameter store. It supports both RSA and ECDSA key algos and enforces a convention on how these keys should be written to SSM, name
/foo/bar
or/foo/bar_badger
. If no key name is given for public/private SSH keys, the label module is used, but the delimiter is forced to be underscore for consistency e.g./ssh_keys/cpco_testing_$app_public_key
. This can be useful for namespacing SSM IAM permissions when for multiple keys in the same account.why
Rather than mounting an s3 based file system using goofys for secrets, we should write them into SSM, to be fetched by chamber.
notes
Fixes #1