Class: RubyTerraform::Commands::StateReplaceProvider

Inherits:
Base
  • Object
show all
Includes:
Options::Global
Defined in:
lib/ruby_terraform/commands/state_replace_provider.rb

Overview

Wraps the terraform state replace-provider command which replaces provider for resources in the Terraform state.

For options accepted on construction, see Base#initialize.

When executing an instance of StateReplaceProvider via Base#execute, the following options are supported:

  • :from: the fully qualified name of the provider to be replaced; required.

  • :to: the fully qualified name of the provider to replace with; required.

  • :chdir: the path of a working directory to switch to before executing the given subcommand.

  • :auto_approve: if true, skips interactive approval; defaults to false.

  • :backup: the path where Terraform should write the backup for the

state file; this can’t be disabled; if not set, Terraform will write it to the same path as the state file with a “.backup” extension.

  • :lock: when true, locks the state file when locking is supported; when false, does not lock the state file; defaults to true.

  • :lock_timeout: the duration to retry a state lock; defaults to “0s”.

  • :state: the path to the state file to update; defaults to the current workspace state.

  • :ignore_remote_version: whether or not to continue even if remote and local Terraform versions are incompatible; this may result in an unusable workspace, and should be used with extreme caution; defaults to false.

The Base#execute method accepts an optional second parameter which is a map of invocation options. Currently, the only supported option is :environment which is a map of environment variables to expose during invocation of the command.

Examples:

Basic Invocation

RubyTerraform::Commands::StateReplaceProvider.new.execute(
  from: 'hashicorp/aws',
  to: 'registry.acme.corp/acme/aws')

Constructor Details

This class inherits a constructor from RubyTerraform::Commands::Base