-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Flagging input variables are sensitive #16114
Comments
Hi @davidvuong! From your message it first sounded like this was a feature request but the part at the end makes me suspect that you've seen a change in behavior between 0.9.10 and 0.10.5 with regard to sensitive value handling. Although the plan display format has changed recently, the Regarding the feature request of marking variables as sensitive: variables don't directly appear in the plan output, so just adding that argument to the declaration would not really change anything. However, I think what you are asking for here is for Terraform to track "sensitive-ness" through interpolations, so for example if you were to write: foo = "baz ${var.sensitive_data} bar" ...Terraform should ideally notice that this If so, this is indeed something we would like to support. The current way interpolations are handled does not lend itself well to this unfortunately, but we're getting started on a revamp of how Terraform deals with configuration and interpolation which should leave us in a better spot to be able to do this sort of analysis. This is not something we can support in the near future, but is something we're making steps towards. |
Hey, thanks for replying. I haven't tested this but I can imagine Example:
Environment variables passed into a lambda function have their value displayed as plain text. Any idea when this might be something considered in a future version or perhaps workarounds to avoid this problem? Thanks |
Hi @davidvuong, Unfortunately aside from describing what we're currently working on (or not working on) we can't comment on specific schedules since our planning methodology is iterative. I can tell you that we are working on the foundational configuration language changes right now but we don't know at this time how long it will take to get all of the architectural changes we need in order for Terraform to be able to trace sensitive values through config -- it requires many more parts of Terraform to be aware of this concept than is true today. Although I expect this isn't the sort of workaround you had in mind, please note that AWS does not generally recommended including secrets directly in Lambda environment variables since they can be accessed by anyone with permissions for the There is a guide for this in the AWS Lambda documentation. The AWS console integrates directly with KMS to make encryption easy, but unfortunately for Terraform this must be done out-of-band, e.g. using the KMS CLI. With that done, what would appear in the diff would then be the ciphertext rather than the the cleartext secret. Unfortunately at this time the AWS provider doesn't have a good solution for producing such ciphertext on the fly, but in principle it could be extended with a new resource that takes some plaintext (marked as |
@apparentlymart Here's another use-case: We use the vsphere provider, and it requires username and password. I could go with sticking my password temporarily in the environment using The way I see it, the experience could be improved with sensitive input variables as a generic solution. Or with a new variable type |
I'm facing the same issue where the environment variables for lambda show up in plain text when I run |
This no longer appears to be the case; that page now merely presents that as a co-equal option:
So this looks like a well-supported use case, but Terraform (0.11 at least) still dumps Lambda environment variable values to the |
Until such time as Terraform is able to do detailed tracing of propagation of sensitive values through expressions (which is still not something there is a ready-to-implement design for), the best answer to hiding sensitive values in the plan output would be to have the AWS provider include an argument marked as sensitive. Since the environment variables is likely to be a mixture of sensitive and non-sensitive values in a single argument that would unfortunately likely require marking that whole map as sensitive, unless there's some signal from the AWS API that would allow the AWS provider to split the variables across two arguments, with one marked as sensitive and the other not. It looks like there's already a proposal open for something like this in the AWS provider repository: hashicorp/terraform-provider-aws#11595. I'd suggest following that to see if it leads to a more straightforward answer for AWS Lambda specifically in the short term. |
Really surprised to see this issue open for so long. I also have same issue where i need to pass license keys to userdata scripts as variables. All our terraform pipelines are run on Jenkins, right now i am not printing the plan or apply logs to stdout instead redirecting to a file. |
I see lots of ideas of how to get around this for specific providers and functions, however it would be good I believe if this could bet set at a global scale independent of the provider. For me it would be good if we could have something generic like variable "myvariable" { |
Note that it seems a PR was recently merged to support this though it hasn't shown up in the release comments yet. Edit: Seems like they are targeting this for the 0.14 release. |
Defining input variables as sensitive in order to redact the values from UI output is now available in 0.14! A recent blog post has more information on this feature, and I'll be closing this one as a result! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform v0.10.5
I think being able to flag input variables as sensitive so
terraform plan
omits them is very useful. I wasn't sure if this was something others have mentioned but perhaps something like:would be perfect.
I was using 0.9.10 and recently upgraded to 0.10.5. Previously, I would see
<computed>
everywhere but it seems changes have improved theplan
command quite a bit. Unfortunately, for me, it now displays sensitive data.The text was updated successfully, but these errors were encountered: