Skip to content

Add a flag to terraform show to hide all values (not just sensitive) #36899

Open
@ricardbejarano

Description

@ricardbejarano

Terraform Version

Terraform v1.11.4
on darwin_arm64

Use Cases

In certain highly confidential environments, a lot of information that would typically not be considered sensitive, is classified as sensitive because only those with need-to-know (NTK) should have access to it.

This divides our team into those with NTK, and those without it, but do not want that divide to "Conway's Law" itself into our infrastructure.

In order to do that, we want to empower no-NTK developers to perform (at least) basic Terraform plan review, so that they are capable of making changes with a non-zero degree of confidence.

Terraform plans, however, are very likely to show data we consider sensitive in this environment (that may not be considered sensitive anywhere else). Mainly resource attribute values (keys are ok, they are in the schema which is public domain) and resource addresses (since for_each may range over sensitive keys).

Attempted Solutions

terraform show -json, then writing a custom script with jq that redacts all attribute values and resource addresses, and converting that JSON plan back to binary for Terraform to render. This, however, is not possible and implementation would be way more difficult than the proposed solution.

Proposal

Add a flag to terraform show, such as -redacted, that redacts all attribute values and resource addresses to be shown in rendering the plan.

This way, we can:

  • terraform plan -out terraform.tfplan and save the output for NTK developers; then
  • terraform show -redacted terraform.tfplan and show the output to no-NTK developers.

I am very aware that only a very slim subset of Terraform users would ever care about this feature, but I also think that an optional boolean flag with some string redaction is a relatively simple feature to maintain, so that we can empower our no-NTK users with a bit more metadata about what's being planned.

References

See #36900 for an example implementation of what I mean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions