pub struct InitCommand { /* private fields */ }Expand description
Command for initializing a Terraform working directory.
Downloads providers, initializes backend, and prepares the directory for other commands.
use terraform_wrapper::{Terraform, TerraformCommand};
use terraform_wrapper::commands::init::InitCommand;
let tf = Terraform::builder().working_dir("/tmp/infra").build()?;
InitCommand::new().execute(&tf).await?;Implementations§
Source§impl InitCommand
impl InitCommand
Sourcepub fn backend(self, enabled: bool) -> Self
pub fn backend(self, enabled: bool) -> Self
Enable or disable backend initialization (-backend).
Sourcepub fn backend_config(self, key: &str, value: &str) -> Self
pub fn backend_config(self, key: &str, value: &str) -> Self
Add a backend configuration key-value pair (-backend-config=key=value).
Sourcepub fn backend_config_file(self, path: &str) -> Self
pub fn backend_config_file(self, path: &str) -> Self
Add a backend configuration file (-backend-config=<path>).
Sourcepub fn from_module(self, source: &str) -> Self
pub fn from_module(self, source: &str) -> Self
Copy the contents of the given module into the target directory (-from-module=SOURCE).
Sourcepub fn get(self, enabled: bool) -> Self
pub fn get(self, enabled: bool) -> Self
Enable or disable downloading modules for this configuration (-get).
Sourcepub fn upgrade(self) -> Self
pub fn upgrade(self) -> Self
Update modules and plugins to the latest allowed versions (-upgrade).
Sourcepub fn reconfigure(self) -> Self
pub fn reconfigure(self) -> Self
Reconfigure backend, ignoring any saved configuration (-reconfigure).
Sourcepub fn migrate_state(self) -> Self
pub fn migrate_state(self) -> Self
Reconfigure backend and attempt to migrate state (-migrate-state).
Sourcepub fn plugin_dir(self, path: &str) -> Self
pub fn plugin_dir(self, path: &str) -> Self
Directory to search for provider plugins (-plugin-dir).
Sourcepub fn lockfile(self, mode: &str) -> Self
pub fn lockfile(self, mode: &str) -> Self
Set the lockfile mode (-lockfile=MODE), e.g. "readonly".
Sourcepub fn lock_timeout(self, timeout: &str) -> Self
pub fn lock_timeout(self, timeout: &str) -> Self
Duration to wait for state lock (-lock-timeout).
Trait Implementations§
Source§impl Clone for InitCommand
impl Clone for InitCommand
Source§fn clone(&self) -> InitCommand
fn clone(&self) -> InitCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InitCommand
impl Debug for InitCommand
Source§impl Default for InitCommand
impl Default for InitCommand
Source§fn default() -> InitCommand
fn default() -> InitCommand
Source§impl TerraformCommand for InitCommand
impl TerraformCommand for InitCommand
Source§type Output = CommandOutput
type Output = CommandOutput
Source§fn supports_input(&self) -> bool
fn supports_input(&self) -> bool
-input=false flag. Read more