Skip to main content

TerraformCommand

Trait TerraformCommand 

Source
pub trait TerraformCommand: Send + Sync {
    type Output: Send;

    // Required methods
    fn args(&self) -> Vec<String>;
    fn execute(
        &self,
        tf: &Terraform,
    ) -> impl Future<Output = Result<Self::Output>> + Send;

    // Provided methods
    fn supports_input(&self) -> bool { ... }
    fn prepare_args(&self, tf: &Terraform) -> Vec<String> { ... }
}
Expand description

Trait implemented by all Terraform command builders.

Each command implements args to produce its CLI arguments and execute to run against a Terraform client.

Required Associated Types§

Source

type Output: Send

The output type produced by this command.

Required Methods§

Source

fn args(&self) -> Vec<String>

Build the argument list for this command.

Returns the subcommand name followed by all flags and options. For example: ["init", "-upgrade", "-backend-config=key=value"].

Source

fn execute( &self, tf: &Terraform, ) -> impl Future<Output = Result<Self::Output>> + Send

Execute this command against the given Terraform client.

Provided Methods§

Source

fn supports_input(&self) -> bool

Whether this command supports the -input=false flag.

Defaults to false. Commands that accept -input (init, plan, apply, destroy, import, refresh) should override this to return true.

Source

fn prepare_args(&self, tf: &Terraform) -> Vec<String>

Build the argument list with -input=false injected when appropriate.

Calls args and, if tf.no_input is set and supports_input returns true, inserts -input=false after the subcommand name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TerraformCommand for ApplyCommand

Source§

impl TerraformCommand for DestroyCommand

Source§

impl TerraformCommand for FmtCommand

Source§

impl TerraformCommand for ForceUnlockCommand

Source§

impl TerraformCommand for GetCommand

Source§

impl TerraformCommand for GraphCommand

Source§

impl TerraformCommand for ImportCommand

Source§

impl TerraformCommand for InitCommand

Source§

impl TerraformCommand for ModulesCommand

Source§

impl TerraformCommand for OutputCommand

Source§

impl TerraformCommand for PlanCommand

Source§

impl TerraformCommand for ProvidersCommand

Source§

impl TerraformCommand for RawCommand

Source§

impl TerraformCommand for RefreshCommand

Source§

impl TerraformCommand for ShowCommand

Source§

impl TerraformCommand for StateCommand

Source§

impl TerraformCommand for TestCommand

Source§

impl TerraformCommand for ValidateCommand

Available on crate feature json only.
Source§

impl TerraformCommand for VersionCommand

Available on crate feature json only.
Source§

impl TerraformCommand for WorkspaceCommand