zuke.tools.terraform

← Python API reference

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

Symbols

#

TerraformApplySettings

class
class TerraformApplySettings(TerraformSettings)

Settings for terraform 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).

#

TerraformDestroySettings

class
class TerraformDestroySettings(TerraformSettings)

Settings for terraform 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.

#

TerraformFmtSettings

class
class TerraformFmtSettings(TerraformSettings)

Settings for terraform 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).

#

TerraformInitSettings

class
class TerraformInitSettings(TerraformSettings)

Settings for terraform 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).

#

TerraformOutputSettings

class
class TerraformOutputSettings(TerraformSettings)

Settings for terraform 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).

#

TerraformPlanSettings

class
class TerraformPlanSettings(TerraformSettings)

Settings for terraform 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).

#

TerraformSettings

class
class TerraformSettings(ToolSettings)

Base for all terraform subcommand settings: binary is terraform.

#

TerraformTasks

class
class TerraformTasks

Typed task functions for the terraform CLI.

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

    Initialize a working directory: terraform init.

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

    Validate the configuration: terraform validate.

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

    Create an execution plan: terraform plan.

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

    Apply the changes: terraform apply.

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

    Destroy managed infrastructure: terraform destroy.

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

    Format configuration files: terraform fmt.

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

    Read output values: terraform output.

#

TerraformValidateSettings

class
class TerraformValidateSettings(TerraformSettings)

Settings for terraform validate.

  • json() -> Self

    Emit machine-readable JSON output (-json).