2 Resources secret
Forgejo Actions edited this page 2026-11-18 21:50:59 +00:00

xyops_secret (Resource)

A secret in the xyOps vault. Field values are write-only: they are sent to xyOps but never stored in OpenTofu plans or state, and never read back. Requires OpenTofu 1.11 or later.

A secret holds one or more variables (fields_wo). The four assignment lists control who may use them. They are lists of IDs, not secrets:

Attribute Who receives the variables
web_hooks Web hooks, as {{ secrets.NAME }} in their URL, headers or body
events Jobs of those events, as environment variables
categories Jobs of every event in those categories
plugins Those plugins when they run

With all four empty, nothing can use the secret.

Rotating a value

OpenTofu cannot see changes to a write-only attribute. Change the value in fields_wo and increase fields_wo_version; the provider then sends the whole fields_wo map again, replacing all of the secret's variables. Changing only the value plans no change.

Schema

Required

  • title (String)

Optional

  • enabled (Boolean) Defaults to true.
  • notes (String)
  • icon (String)
  • fields_wo (Map of String, Sensitive, Write-only) Secret variables, as name = value. Names must be valid environment variable names. Sent on create, and on update only when fields_wo_version changes.
  • fields_wo_version (Number) Change this to send fields_wo again. Required when fields_wo is set.
  • events, categories, plugins, web_hooks (Set of String) Assignment lists, as above. Omit one to leave it unmanaged.
  • id (String) Generated by xyOps when omitted. Changing it replaces the secret.

Read-Only

  • names (Set of String) Names of the secret's variables, as reported by xyOps.

Import

tofu import xyops_secret.example example

Import reads the secret's metadata (title, assignments and variable names) so the first plan is empty. Values cannot be imported: xyOps only returns them through its admin-only decrypt_secret action, which this provider never calls. After importing, leave fields_wo unset to keep the current values, or set fields_wo and fields_wo_version to replace them.

Upgrading from 0.1.2-dev.2 or earlier

The old value, category and params attributes did not match the xyOps API and are removed. Existing state is upgraded automatically: the stored value is deleted from state, and the next refresh reads names and assignments from xyOps. Replace value with fields_wo plus fields_wo_version in your configuration.