Secrets

A Secret stores named, typed secret material for later use by features that reference the Secret by ID.

Secret values are encrypted at rest and are write-only. API responses include metadata and configured value field names, but never include the stored secret values.

Resource Schema

Required

PropertyDescription
name
String
Secret name.
secret_type
String
Secret type.
Possible values: basic, token, headers, certificate, key_value

Optional

PropertyDescription
workspace_id
Int64
Workspace ID. 0 means the default workspace.
description
String
Internal description for your reference.
metadata
Dynamic
Non-secret metadata for the Secret type.

Read Only

PropertyDescription
id
Int64
Secret ID.
value_field_names
List
Names of configured secret value fields. Secret values are never returned.
created_at
String
Secret create date/time.
updated_at
String
Secret update date/time.

Example Resource

resource "files_secret" "example_secret" {
  name         = "Production API token"
  description  = "Used by production API integrations."
  secret_type  = "token"
  metadata     = {
    key = "example value"
  }
  workspace_id = 0
}

Resource Import

This Resource supports importing using the following syntax:

Example Import Command

# Secrets can be imported by specifying the id.
terraform import files_secret.example_secret 1

Data Source Schema

Required

PropertyDescription
id
Int64
Secret ID.

Read Only

PropertyDescription
workspace_id
Int64
Workspace ID. 0 means the default workspace.
name
String
Secret name.
description
String
Internal description for your reference.
secret_type
String
Secret type.
Possible values: basic, token, headers, certificate, key_value
metadata
Dynamic
Non-secret metadata for the Secret type.
value_field_names
List
Names of configured secret value fields. Secret values are never returned.
created_at
String
Secret create date/time.
updated_at
String
Secret update date/time.

Example Data Source

data "files_secret" "example_secret" {
  id = 1
}