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

[Enhancement]: support values_wo in vault_generic_secret to keep data out of state #2406

Open
joemiller opened this issue Feb 16, 2025 · 0 comments

Comments

@joemiller
Copy link
Contributor

joemiller commented Feb 16, 2025

Description

The AWS provider's aws_ssm_parameter recently added a values_wo attribute that avoids persisting sensitive values to state. The vault_generic_secret resource (and probably vault_kv_secret_v2 too) could benefit from a similar feature.

In the AWS SSM case it needs to be used with values_wo_version to trigger an update. One option here is to use a hash of the sensitive value to trigger the update. But this is not required since some users may have stricter requirements that don't allow using an unsalted hash or have other mechanisms to trigger the update.

This should address the open issue in #65

Affected Resource(s) and/or Data Source(s)

  • vault_generic_secret
  • vault_kv_secret_v2

Potential Terraform Configuration

resource "vault_generic_secret" "example" {
  path = "secret/foo"

  data_json_wo_version = "1"

  data_json_wo = <<EOT
{
  "foo":   "bar",
  "pizza": "cheese"
}
EOT
}



resource "vault_kv_secret_v2" "example" {
  mount                      = vault_mount.kvv2.path
  name                       = "secret"
  cas                        = 1
  delete_all_versions        = true
  data_json_wo_version       = "1"
  data_json_wo               = jsonencode(
  {
    zip       = "zap",
    foo       = "bar"
  }
  )
  custom_metadata {
    max_versions = 5
    data = {
      foo = "[email protected]",
      bar = "12345"
    }
  }
}

References

Would you like to implement a fix?

Maybe

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

No branches or pull requests

1 participant