hashicorp / hashicorp/terraform

Manual sensitivity override for resource attributes

Open
#29,331 4 comments 4 reactions 0 assignees View on GitHub
config enhancement
Dominant language
Go
Stars
49.7k
Forks
10.6k
Avg merge
21h 30m
Merged PRs (30d)
100

Description

### Current Terraform Version
```
Terraform v1.0.4
on linux_amd64
```

### Use-cases
A provider output could sometimes be sensitive, but sometimes not. For example: configuration transpilers that convert human-readable formats to machine-readable formats such as the Container Linux transpiler (https://github.com/poseidon/terraform-provider-ct). Usually, the configuration is not sensitive, but sometimes, the configuration is sensitive.

Currently, I am able to mark the input as sensitive, to prevent the data from showing in the console output. However, the output is not marked sensitive by the provider developer (since usually this is non-sensitive indeed), and thus the output does show in my console.

I would like to be able to mark the output as sensitive as well, some kind of manual override of some sort.

### Attempted Solutions
I don't know of a way to mark the provider output as sensitive without changing the provider code.

### Proposal
I don't know the best way to achieve this. Some first thoughts:
- Maybe enable a provider to dynamically mark outputs sensitive or not. This would make the specification non-constant, which is not great, but that would allow a flag within the resource like `isOutputSensitive` to manually change the sensitivity of the respective output.
- Maybe let the user specify the sensitivity of output variables by hand, by adding a configuration section to the resource itself such as `output { some_field { sensitive = true } }`, but that might be too complicated

### References
Not that I know of

Contributor guide

Open the contributing guide

Research direction

No files, tests, or implementation entry points are named. Start by reproducing the Terraform v1.0.4 behavior with a provider output that is sometimes sensitive, then trace how sensitivity is propagated to console output; done means users can manually override an output's sensitivity without changing provider code.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform
Domain
infrastructure, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.