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

Pass SSH private key using env var #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diamondburned
Copy link

This hides the private key in the Terraform output. I'm not sure if this is enough to make the entire output public, but it's a step.

This hides the private key in the Terraform output. I'm not sure if this
is enough to make the entire output public, but it's a step.
"switch",
var.delete_older_than,
],
local.extra_build_args
)
command = "ignoreme"
environment = {
BUILD_ON_TARGET = local.build_on_target
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the ssh_private_key a environmnet variable makes sense to me to avoid sensitive data in the output, but why is build_on_target also being moved to an env var? I don't think there's necessary any reason it shouldn't be an env var, but I also see no reason to move it.

"switch",
var.delete_older_than,
],
local.extra_build_args
)
command = "ignoreme"
environment = {
BUILD_ON_TARGET = local.build_on_target
SSH_PRIVATE_KEY = local.ssh_private_key == "" ? "-" : local.ssh_private_key

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this will hide the key itself from output, a variable still marked as sensitive will cause the output to be suppressed. Might be worth wrapping this in nonsensitive() although that would require bumping the minimum required terraform version from 0.12 to 0.15. Also there should be nothing stopping callers from wrapping the key in nonsensitive() when they pass it to this module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants