class RubyTerraform::Commands::StateRemove

Wraps the +terraform state rm+ command which removes one or more items from the Terraform state, causing Terraform to “forget” those items

without first destroying them in the remote system.

This command removes one or more resource instances from the Terraform state based on the addresses given. You can view and list the available instances with {StateList}.

If you give the address of an entire module then all of the instances in that module and any of its child modules will be removed from the state.

If you give the address of a resource that has “count” or “for_each” set, all of the instances of that resource will be removed from the state.

For options accepted on construction, see {#initialize}.

When executing an instance of {StateRemove} via {#execute}, the following options are supported:

@example Basic Invocation

RubyTerraform::Commands::StateRemove.new.execute(
  address: 'packet_device.worker')

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/state_remove.rb, line 75
def arguments(parameters)
  [parameters[:address], parameters[:addresses]]
end
options() click to toggle source

@!visibility private

Calls superclass method RubyTerraform::Options::Global#options
# File lib/ruby_terraform/commands/state_remove.rb, line 63
def options
  %w[
    -dry-run
    -backup
    -lock
    -lock-timeout
    -state
    -ignore-remote-version
  ] + super
end
subcommands() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/state_remove.rb, line 58
def subcommands
  %w[state rm]
end