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)
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
terraform apply
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
Terraform, Provider, Kubernetes and Helm Versions
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
terraform applyterraform destroyExpected Behavior
Apply succeeds. In the
planoutput for the destroy, the value for thefoo.barkey under themetadataattribute is marked assensitive:Actual Behavior
Apply succeeds. In the
planoutput for the destroy, the value for thefoo.barkey under themetadataattribute is shown in original plain text (not markedsensitive):Important Factoids
The value is also shown in original plain text in Terraform 0.14.x and earlier in the
planoutput ahead of anapplywhen 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_sensitiveblock, not themetadataattribute.References
Community Note