Metadata-Version: 2.4
Name: hegemony-steps-tf
Version: 0.59.1
Summary: OpenTofu/Terraform plan and apply step handlers for Hegemony
License-Expression: AGPL-3.0-or-later
License-File: LICENSE-AGPL-3.0-or-later.txt
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Systems Administration
Requires-Dist: hegemony-step-sdk>=1.1,<2
Requires-Dist: hegemony-steps-container==0.59.1
Requires-Python: >=3.11
Project-URL: Homepage, https://hegemony.sh
Project-URL: Documentation, https://hegemony.sh
Project-URL: Source, https://github.com/hegemony-sh/hegemony-step-plugins
Project-URL: Issues, https://github.com/hegemony-sh/hegemony-step-plugins/issues
Project-URL: Changelog, https://github.com/hegemony-sh/hegemony-step-plugins/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

<!--
SPDX-FileCopyrightText: 2025-2026 Rexonix s.r.o.
SPDX-FileContributor: Jakub Trávník <jakub.travnik@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
-->

# hegemony-steps-tf

OpenTofu and Terraform for Hegemony flows — the `tf.` namespace.

Handlers:

- `tf.plan` — init, validate and plan a configuration from the flow's
  attachments. The saved plan stays in the run's shared workspace, the
  readable plan is kept as evidence, and the step output reports what would
  change (counts and resource addresses, never values), so a branch or an
  approval can act on it. A scheduled plan-only flow is drift detection.
- `tf.apply` — apply exactly the plan a `tf.plan` step saved earlier in the
  run, in the same working directory and image; the step refuses a saved plan
  that changed since it was made, and the tool refuses a plan made stale by a
  state change.

OpenTofu is the default engine and Terraform is selectable; the engine never
appears in the handler id (CONVENTIONS.md, rule 3). By default the platform
stores the state (managed state: locked, versioned, encrypted); the
configuration's own backend, or ephemeral per-run state for tests, are the
alternatives.
Provider credentials, secret variables and OpenTofu's state encryption key are
secret references, resolved by the platform, passed as files, and redacted
from output.

Both steps run on the platform's Docker-in-Docker sandbox through
`container.run`'s runner (this wheel depends on `hegemony-steps-container`),
under the flow's egress policy. OpenTofu's default image is
`ghcr.io/hegemony-sh/opentofu-runner:0.59`, built and published from
`images/opentofu-runner/` in this repository, with OpenTofu 1.12; Terraform's
is HashiCorp's `hashicorp/terraform` at an exact version, Terraform 1.16
today. The image tags do not name those versions, so both steps report the
version that ran in their output (`tool_version`), and only a minor release
of the plugins moves to another OpenTofu or Terraform series. The plan
step's OpenTofu version setting picks a series instead of the default: 1.12
or 1.13, each published as its own tag (`X.Y-tofu1.13`). `tf.apply` runs the plan's image by
the registry digest the plan recorded, or by its tag when the image has no
digest (one built on the sandbox and never pushed).
