GPG Keys

A GPGKey object on Files.com is used to securely store both the private and public keys associated with a GPG (GNU Privacy Guard) encryption key pair. This object enables the encryption and decryption of data using GPG, allowing you to protect sensitive information.

The private key is kept confidential and is used for decrypting data or signing messages to prove authenticity, while the public key is used to encrypt messages that only the owner of the private key can decrypt.

By storing both keys together in a GPGKey object, Files.com makes it easier to understand encryption operations, ensuring secure and efficient handling of encrypted data within the platform.

Resource Schema

Required

PropertyDescription
name
String
GPG key name.

Optional

PropertyDescription
workspace_id
Int64
Workspace ID (0 for default workspace).
partner_id
Int64
Partner ID who owns this GPG Key, if applicable.
user_id
Int64
User ID who owns this GPG Key, if applicable.
public_key
String
The GPG public key
private_key
String
The GPG private key
private_key_password
String
The GPG private key password
generate_expires_at
String
Expiration date of the key. Used for the generation of the key. Will be ignored if generate_keypair is false.
generate_keypair
Bool
If true, generate a new GPG key pair. Can not be used with public_key/private_key
generate_full_name
String
Full name of the key owner. Used for the generation of the key. Will be ignored if generate_keypair is false.
generate_email
String
Email address of the key owner. Used for the generation of the key. Will be ignored if generate_keypair is false.

Read Only

PropertyDescription
id
Int64
GPG key ID.
expires_at
String
GPG key expiration date.
partner_name
String
Name of the Partner who owns this GPG Key, if applicable.
public_key_md5
String
MD5 hash of the GPG public key
private_key_md5
String
MD5 hash of the GPG private key.
generated_public_key
String
GPG public key
generated_private_key
String
GPG private key.
private_key_password_md5
String
GPG private key password. Only required for password protected keys.

Example Resource

resource "files_gpg_key" "example_gpg_key" {
  user_id             = 1
  partner_id          = 1
  name                = "key name"
  workspace_id        = 0
  generate_expires_at = "2025-06-19 12:00:00"
  generate_keypair    = false
  generate_full_name  = "John Doe"
  generate_email      = "jdoe@example.com"
}

Resource Import

This Resource supports importing using the following syntax:

Example Import Command

# Gpg Keys can be imported by specifying the id.
terraform import files_gpg_key.example_gpg_key 1

Data Source Schema

Required

PropertyDescription
id
Int64
GPG key ID.

Read Only

PropertyDescription
workspace_id
Int64
Workspace ID (0 for default workspace).
expires_at
String
GPG key expiration date.
name
String
GPG key name.
partner_id
Int64
Partner ID who owns this GPG Key, if applicable.
partner_name
String
Name of the Partner who owns this GPG Key, if applicable.
user_id
Int64
User ID who owns this GPG Key, if applicable.
public_key_md5
String
MD5 hash of the GPG public key
private_key_md5
String
MD5 hash of the GPG private key.
generated_public_key
String
GPG public key
generated_private_key
String
GPG private key.
private_key_password_md5
String
GPG private key password. Only required for password protected keys.

Example Data Source

data "files_gpg_key" "example_gpg_key" {
  id = 1
}