Skip to content

helm_release metadata not cloaked when key contains "." character #737

Description

@camlow325

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: 0.15.0, 0.14.0
Provider version: 2.1.1
Kubernetes version: 1.17.12

Affected Resource(s)

  • helm_release

Terraform Configuration Files

resource "helm_release" "example" {
  name = "redis"

  repository = "https://charts.bitnami.com/bitnami"
  chart      = "redis"

  set {
    name  = "replica.replicaCount"
    value = 0
  }

  set_sensitive {
    name  = "auth.password"
    value = "foo"
  }

  set_sensitive {
    name  = "foo\\.bar"
    value = "baz"
  }
}

Steps to Reproduce

  1. terraform apply
  2. terraform destroy

Expected Behavior

Apply succeeds. In the plan output for the destroy, the value for the foo.bar key under the metadata attribute is marked as sensitive:

  # helm_release.example will be destroyed
  - resource "helm_release" "example" {
...
      - metadata                   = [
          - {
... 
             - values      = jsonencode(
                    {
...
                      - foo.bar = "(sensitive value)"

Actual Behavior

Apply succeeds. In the plan output for the destroy, the value for the foo.bar key under the metadata attribute is shown in original plain text (not marked sensitive):

  # helm_release.example will be destroyed
  - resource "helm_release" "example" {
...
      - metadata                   = [
          - {
... 
             - values      = jsonencode(
                    {
...
                      - foo.bar = "baz"

Important Factoids

The value is also shown in original plain text in Terraform 0.14.x and earlier in the plan output ahead of an apply when the concise diff feature is disabled (TF_X_CONCISE_DIFF=0).

When the key does not have a "." character in it, (e.g., using name = "foo.bar" in the example above, the value is shown as "(sensitive value)", as expected. In our case, though we need to set a key with a "." in its name, due to how the underlying Helm chart has been designed. We use \\. to escape the "." character, in order to avoid having it be misinterpreted as a delimiter for a YAML "sub-map".

It doesn't appear that using the new sensitive function in Terraform 0.15 would help in this case since the sensitivity only applies to the set_sensitive block, not the metadata attribute.

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions