title: Terraform hash input variables
body: <p>when working with the resources of the random provider, it's useful to configure <code>keepers</code> so that the rendered result changes when the related <code>keepers</code> changes. I'd love to define all of my input variables as <code>keepers</code> so that the <code>random_string</code> changes whenever the inputs change.</p>
  
  <p>The minimal example is sth like:</p>
  
  <pre><code>variable "var1"         { type = "string" }
  variable "var2"         { type = "string" }
  
  resource "random_string" "rnd" {
    length = 16
    special = false
    keepers = {
        variables = "${sha256(jsonencode(var))}"
    }
  }
  
  output "rnd" {
    value = "${random_string.rnd.result}"
  }
  </code></pre>
  
  <p>Unfortunately this will create this error:</p>
  
  <pre><code>random_string.rnd: invalid variable syntax: "var". Did you mean 'var.var'? If this is part of inline `template` parameter
  </code></pre>
  
  <p>then you must escape the interpolation with two dollar signs. For
  example: ${a} becomes $${a}.</p>
  
  <p>The only solution I found so far is to "embed" all of the input variables into the resource definition like so:</p>
  
  <pre><code>variable "var1"         { type = "string" }
  variable "var2"         { type = "string" }
  
  resource "random_string" "rnd" {
    length = 16
    special = false
    keepers = {
        variables = "${sha256("${var.var1}${var.var2}")}"
    }
  }
  </code></pre>
  
  <p>Is there a more flexible way to solve this in terraform?
  Thx</p>