zuke.tools.tofu

← Python API reference

@zuke/tofu 1.0.1: @zuke/tofu — typed TofuTasks wrappers for the OpenTofu CLI (tofu), for use in Zuke build targets (infrastructure-as-code workflows).

Symbols

#

TofuApplySettings

class
class TofuApplySettings(TofuSettings)

Settings for tofu apply.

  • auto_approve() -> Self

    Apply without an interactive approval prompt (-auto-approve).

  • var(name: str, value: str) -> Self

    Set an input variable (-var=name=value); repeatable.

  • var_file(path: str) -> Self

    Load variables from a file (-var-file=); repeatable.

  • no_input() -> Self

    Do not prompt for input (-input=false).

  • plan_file(path: str) -> Self

    Apply a previously saved plan file (positional argument).

#

TofuDestroySettings

class
class TofuDestroySettings(TofuSettings)

Settings for tofu destroy.

  • auto_approve() -> Self

    Destroy without an interactive approval prompt (-auto-approve).

  • var(name: str, value: str) -> Self

    Set an input variable (-var=name=value); repeatable.

  • var_file(path: str) -> Self

    Load variables from a file (-var-file=); repeatable.

#

TofuFmtSettings

class
class TofuFmtSettings(TofuSettings)

Settings for tofu fmt.

  • check() -> Self

    Check formatting without writing changes (-check).

  • recursive() -> Self

    Also process nested directories (-recursive).

  • diff() -> Self

    Show a diff of formatting changes (-diff).

#

TofuInitSettings

class
class TofuInitSettings(TofuSettings)

Settings for tofu init.

  • upgrade() -> Self

    Upgrade modules and plugins to the latest versions (-upgrade).

  • reconfigure() -> Self

    Reconfigure the backend, ignoring saved config (-reconfigure).

  • no_backend() -> Self

    Disable backend initialization (-backend=false).

  • no_input() -> Self

    Do not prompt for input (-input=false).

#

TofuOutputSettings

class
class TofuOutputSettings(TofuSettings)

Settings for tofu output.

  • json() -> Self

    Emit machine-readable JSON output (-json).

  • raw() -> Self

    Emit a single value with no quotes (-raw); requires a name.

  • name(value: str) -> Self

    Read a single named output (positional argument).

#

TofuPlanSettings

class
class TofuPlanSettings(TofuSettings)

Settings for tofu plan.

  • out(path: str) -> Self

    Write the plan to a file (-out=).

  • var(name: str, value: str) -> Self

    Set an input variable (-var=name=value); repeatable.

  • var_file(path: str) -> Self

    Load variables from a file (-var-file=); repeatable.

  • destroy() -> Self

    Plan a destroy run (-destroy).

  • no_input() -> Self

    Do not prompt for input (-input=false).

#

TofuSettings

class
class TofuSettings(ToolSettings)

Base for all tofu subcommand settings: binary is tofu.

#

TofuTasks

class
class TofuTasks

Typed task functions for the tofu CLI.

  • static async init(ctx: ServiceContext, configure: Callable[[TofuInitSettings], TofuInitSettings] | None=None) -> ExecResult

    Initialize a working directory: tofu init.

  • static async validate(ctx: ServiceContext, configure: Callable[[TofuValidateSettings], TofuValidateSettings] | None=None) -> ExecResult

    Validate the configuration: tofu validate.

  • static async plan(ctx: ServiceContext, configure: Callable[[TofuPlanSettings], TofuPlanSettings] | None=None) -> ExecResult

    Create an execution plan: tofu plan.

  • static async apply(ctx: ServiceContext, configure: Callable[[TofuApplySettings], TofuApplySettings] | None=None) -> ExecResult

    Apply the changes: tofu apply.

  • static async destroy(ctx: ServiceContext, configure: Callable[[TofuDestroySettings], TofuDestroySettings] | None=None) -> ExecResult

    Destroy managed infrastructure: tofu destroy.

  • static async fmt(ctx: ServiceContext, configure: Callable[[TofuFmtSettings], TofuFmtSettings] | None=None) -> ExecResult

    Format configuration files: tofu fmt.

  • static async output(ctx: ServiceContext, configure: Callable[[TofuOutputSettings], TofuOutputSettings] | None=None) -> ExecResult

    Read output values: tofu output.

#

TofuValidateSettings

class
class TofuValidateSettings(TofuSettings)

Settings for tofu validate.

  • json() -> Self

    Emit machine-readable JSON output (-json).