# Passwords/Sensitive data in TfState files

**URL:** <https://discuss.hashicorp.com/t/passwords-sensitive-data-in-tfstate-files/2446>\
**Category:** Terraform\
**Created:** [August 19, 2019, 8:08pm UTC](https://discuss.hashicorp.com/t/passwords-sensitive-data-in-tfstate-files/2446 "2019-08-19T20:08:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [August 20, 2019, 5:19pm UTC](https://discuss.hashicorp.com/t/passwords-sensitive-data-in-tfstate-files/2446/2 "2019-08-20T17:19:15Z")

</div>

Hi @adi658,

Whether a value is stored in the state depends on how it is _used_ rather than how it is passed in to Terraform. Any value you use in the arguments inside a `resource` or `data` block, along with any values _exported_ by the resource type or data source, will always be in the state, so that they can be used for planning on future runs.

There are some specific places you can use values where they will _not_ appear in the state:

- Inside `provider` blocks
- Inside `provisioner` blocks within `resource` blocks
- Inside `connection` blocks within `resource` or `provisioner` blocks

As long as you only use `var.password` in one of the above contexts, it will not appear in the state snapshot.

* * *

[Terraform Cloud](https://app.terraform.io/signup) offers free remote state storage, which is one free option though it does still require you to create a Terraform Cloud account.

There are several remote backends that can be used with infrastructure you run yourself, such as [`http`](https://www.terraform.io/docs/backends/types/http.html), [`consul`](https://www.terraform.io/docs/backends/types/consul.html), and [`pg`](https://www.terraform.io/docs/backends/types/pg.html). The `http` backend gives the most flexibility since you can implement a custom HTTP application that recieves and stores the state snapshots however you like, including using your own encryption keys for encryption at rest.

---

_[View the full topic](https://discuss.hashicorp.com/t/passwords-sensitive-data-in-tfstate-files/2446)._
