How to hide local_file content during plan?

Hi there!,

I have a local_file resource that takes a filename as an input (the file already exists with sensitive content). Whenever I run terraform plan or terraform apply, The content of the file are shown, no matter where I try and put the keyword sensitive.

local_file example:

data "local_file" "information" {
  filename = sensitive(local.sensitive_file)
  depends_on = [null_resource.gather_information]

plan example:

data "local_file" "information"  {
      ~ content        = "secret_text_here" -> (known after apply)
      ~ content_base64 = "base_64_secret_text_here" -> (known after apply)
      ~ id             = "1abe6c6cf786958bed2d7e03f958a6face819851" -> (known after apply)
        # (1 unchanged attribute hidden)

Is there a way to somehow hid or disable the logging of content and content_base64?

Thanks! :slight_smile:

Hi @Pobek,

There is currently now way to make Terraform treat a resource attribute as sensitive unless the provider itself marks it so. The local_file provider doesn’t really know what your file represents and so it doesn’t know to mark it as sensitive, and there’s currently no way to tell it that.