OpenTofu provider for xyOps.
  • Go 98.1%
  • Python 1.3%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
John a7e2ca961e
All checks were successful
CI / release-check-1 (push) Successful in 13s
Release / release-1 (push) Successful in 13s
CI / release-check (push) Successful in 0s
Release / release (push) Successful in 0s
CI / check (push) Successful in 2m6s
Merge pull request 'ci: wait for the required push checks before signing (yawn 0.3.1-dev.5)' (#32) from ci/wait-before-signing into main
2026-11-26 08:22:30 +00:00
.forgejo ci: wait for the required push checks before signing (yawn 0.3.1-dev.5) 2026-11-26 08:07:05 +00:00
docs refactor: shared base for resources/data sources; remove examples; yawn tasks replace Makefile (0.1.2-dev.9) 2026-11-18 21:48:23 +00:00
internal refactor: shared base for resources/data sources; remove examples; yawn tasks replace Makefile (0.1.2-dev.9) 2026-11-18 21:48:23 +00:00
.env.example refactor: shared base for resources/data sources; remove examples; yawn tasks replace Makefile (0.1.2-dev.9) 2026-11-18 21:48:23 +00:00
.gitignore Release channels: X.Y.Z-dev.N / -preview.N / -rc.N / X.Y.Z; pin govulncheck 2026-11-16 14:01:30 +00:00
.golangci.yml Add the xyOps Terraform provider. 2026-10-16 12:33:21 -03:00
CHANGELOG.md refactor: shared base for resources/data sources; remove examples; yawn tasks replace Makefile (0.1.2-dev.9) 2026-11-18 21:48:23 +00:00
docker-compose.yml Add the xyOps Terraform provider. 2026-10-16 12:33:21 -03:00
go.mod Fork as tofu-provider-xyops: credit Eduardo Santos, OpenTofu-only, own module path 2026-11-16 13:17:26 +00:00
go.sum Add the xyOps Terraform provider. 2026-10-16 12:33:21 -03:00
LICENSE Add the xyOps Terraform provider. 2026-10-16 12:33:21 -03:00
main.go Fork as tofu-provider-xyops: credit Eduardo Santos, OpenTofu-only, own module path 2026-11-16 13:17:26 +00:00
NOTICE Fork as tofu-provider-xyops: credit Eduardo Santos, OpenTofu-only, own module path 2026-11-16 13:17:26 +00:00
README.md refactor(release): use the shared yawn deploy client for signing 2026-11-22 14:36:36 +00:00
release.json Use shared release-tied wiki publishing (#13) 2026-11-17 00:44:13 +00:00
terraform-registry-manifest.json Add the xyOps Terraform provider. 2026-10-16 12:33:21 -03:00
VERSION refactor: shared base for resources/data sources; remove examples; yawn tasks replace Makefile (0.1.2-dev.9) 2026-11-18 21:48:23 +00:00
yawn.json ci: wait for the required push checks before signing (yawn 0.3.1-dev.5) 2026-11-26 08:07:05 +00:00

tofu-provider-xyops

An OpenTofu provider for xyOps, a server scheduler and monitor. It is served privately as registry.yawn.dev/john/xyops.

Credit

This is a fork of terraform-provider-xyops by Eduardo Santos (@santos-edu). Eduardo wrote the provider, its resources, data sources, documentation and test suite. Thank you, Eduardo. The upstream project is published as santos-edu/xyops on the Terraform and OpenTofu registries.

The fork starts from upstream commit 091fa9f (v0.1.1) with full history. It remains under the original MIT licence, with Eduardo's copyright notice kept intact. See NOTICE. Fixes that are useful upstream should be offered back there.

Changes in this fork

  • Event and web hook imports hydrate state through Read, and JSON attributes are compared semantically.
  • The Go module is code.yawn.dev/john/tofu-provider-xyops, and the plugin serves the address registry.yawn.dev/john/xyops.
  • Built and tested for OpenTofu only.

The terraform-provider- prefix on the built binary is a plugin-protocol requirement: OpenTofu only loads executables named terraform-provider-<name>_v<version>. It does not mean this fork targets Terraform.

Configuration

endpoint and api_key are required in the provider block or via XYOPS_ENDPOINT and XYOPS_API_KEY.

The client is strict by design:

  • endpoint must be https://. Plain http:// is accepted only for loopback hosts (localhost, 127.0.0.0/8, ::1), for local testing.
  • Redirects are never followed, because they could carry the API key to another host and turn writes into reads. Set endpoint to the final URL.
  • Each request times out after 30 seconds. Change it with request_timeout_seconds (1-600) or XYOPS_REQUEST_TIMEOUT_SECONDS.
  • Reads (GET) are retried up to 3 times on HTTP 429, 502, 503, 504 or a connection error, with backoff and Retry-After honoured up to 10 seconds. Writes (POST) are never retried.
  • Responses over 32 MiB are rejected, and server text quoted in errors is limited to 256 bytes with control characters removed.
  • Requests send User-Agent: tofu-provider-xyops/<version>.
terraform {
  required_providers {
    xyops = {
      source  = "registry.yawn.dev/john/xyops"
      version = "~> 0.1"
    }
  }
}

provider "xyops" {
  endpoint = "https://xyops.example.com"
}

Resources and data sources

Full reference, with every attribute: the wiki. It is published from docs/ at each new release tag by john/release, so change the docs with a pull request, not in the wiki. Unreleased changes on main do not automatically replace the published reference.

Resources: xyops_alert, xyops_api_key, xyops_bucket, xyops_category, xyops_channel, xyops_config, xyops_event, xyops_group, xyops_monitor, xyops_plugin, xyops_role, xyops_secret, xyops_server, xyops_tag, xyops_webhook, xyops_workflow.

Data sources: xyops_alerts, xyops_jobs, xyops_servers. They call the xyOps search_* actions. query uses xyOps index syntax (* lists everything). offset defaults to 0 and limit defaults to 100.

Read-only lookups by ID: xyops_event, xyops_web_hook, xyops_category, xyops_plugin, xyops_monitor, xyops_role, xyops_secret (metadata only; values are never requested) and the singleton xyops_config. Each returns title, enabled and the full object as normalised json. xyops_web_hook always omits url, headers and body, which often embed credentials.

xyops_secret field values are write-only (fields_wo): they are sent to xyOps but never stored in plans or state, and the provider never reads them back. Increase fields_wo_version to rotate them; see xyops_secret. Webhook url, headers and body, and xyops_api_key key and plain_key are sensitive: OpenTofu redacts them in CLI output, but xyOps returns them in clear text, so state stores them in clear text. Protect the state the same way you protect the API key; OpenTofu client-side state encryption is recommended.

xyops_server adopts a server the agent already registered. It does not create or delete it. Destroy, or removing the block, only stops managing it. Omitting enabled keeps the current value. id allows lowercase letters, digits, and underscore.

xyops_config is a singleton: import it with the ID global. Destroying it, or removing it from configuration, only removes it from state; xyOps keeps its job_universal_actions. To clear them, set an empty value and apply first.

Every other resource imports by xyOps id. Import reads the object from xyOps and fills in its optional attributes, including JSON ones, so the first plan after importing an object whose configuration matches xyOps is empty.

tofu import xyops_alert.high_cpu high_cpu

JSON attributes are compared by structure. Write them with jsonencode(). Reference lists keep the order xyOps returns.

Development

Tasks live in yawn.json and run the same locally and in CI (yawn tasks lists them; pinned Go and OpenTofu are installed into ~/.cache/yawn/tofu-provider-xyops):

  • yawn run check: gofmt, go mod verify, vet, unit and fake-HTTP tests, govulncheck (what CI runs).
  • yawn run build: writes terraform-provider-xyops in the repository root; point a dev_overrides entry for registry.yawn.dev/john/xyops at it.
  • yawn run testacc: acceptance tests against a live xyOps from XYOPS_ENDPOINT / XYOPS_API_KEY (docker compose up -d starts one; see .env.example).
  • yawn run lint: golangci-lint with .golangci.yml.

docs/ is the published reference and is maintained by hand (there are no examples); a test fails if any schema attribute is missing from its page.

All resources and data sources embed one base (internal/provider/base.go) for provider configuration, the "not configured" guard, get_*/delete_* with not-found handling, the shared id attribute and the type name.

Release

CI (.forgejo/workflows/ci.yml) runs on every pull request and push to main: gofmt, go mod verify, go vet, tests, govulncheck, and a check that two clean builds are byte-identical. The shared release-check also validates docs/ using the shared wiki generator. .forgejo/workflows/wiki.yml calls john/release to publish docs/ to the wiki at the new release tag (including dev/preview/rc), independently of the artifact build. A manual run on main is an explicit maintenance override. The footer records the exact source commit/ref; wiki edits are replaced, and older release runs are refused. Go 1.27.4 and OpenTofu 1.13.9 are downloaded from their official sources and checked against pinned SHA-256 digests.

Versions follow SemVer with release channels:

Tag Channel Forgejo release
vX.Y.Z-dev.N development pre-release
vX.Y.Z-preview.N preview pre-release
vX.Y.Z-rc.N release candidate pre-release
vX.Y.Z stable (main release) release

Release notes come from the ## [X.Y.Z] section of CHANGELOG.md. Pre-releases may use ## [X.Y.Z] - Unreleased; a stable release needs the dated form ## [X.Y.Z] - YYYY-MM-DD.

Releases use the shared policy in john/release. VERSION holds the current version; release.json lists it and CHANGELOG.md as the only version locations. To release, open a PR that changes VERSION (for example with release.py next dev then release.py bump X.Y.Z-dev.N from john/release) and its changelog section. PR CI checks that the version is new, newer than every tag and has notes. Merging the reviewed PR is the approval: .forgejo/workflows/release.yml tags that exact merge commit, records the Forgejo release and starts publish.yml at the tag. publish.yml re-runs the checks, builds linux_amd64 and linux_arm64 zips with a SHA256SUMS file and attaches them. Merges that don't change VERSION release nothing. Published assets are never replaced. After uploading, publish asks the deployer to sign the release (yawn deploy provider_sign, which waits for completion): it GPG-signs SHA256SUMS and publishes the version on registry.yawn.dev, so consumers install it with a plain tofu init (OpenTofu verifies the signature).