class RubyTerraform::Commands::ProvidersLock

Wraps the +terraform providers lock+ command which writes out dependency locks for the configured providers.

Normally the dependency lock file (.terraform.lock.hcl) is updated automatically by “terraform init”, but the information available to the normal provider installer can be constrained when you're installing providers from filesystem or network mirrors, and so the generated lock file can end up incomplete.

The “providers lock” subcommand addresses that by updating the lock file based on the official packages available in the origin registry, ignoring the currently-configured installation strategy.

After this command succeeds, the lock file will contain suitable checksums to allow installation of the providers needed by the current configuration on all of the selected platforms.

By default this command updates the lock file for every provider declared in the configuration. You can override that behavior by providing one or more provider source addresses on the command line.

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

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

@example Basic Invocation

RubyTerraform::Commands::ProvidersLock.new.execute(
  fs_mirror: "/usr/local/terraform/providers",
  platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"],
  provider: "tf.example.com/ourcompany/ourplatform")

Public Instance Methods

arguments(parameters) click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/providers_lock.rb, line 92
def arguments(parameters)
  [parameters[:provider], parameters[:providers]]
end
options() click to toggle source

@!visibility private

Calls superclass method RubyTerraform::Options::Global#options
# File lib/ruby_terraform/commands/providers_lock.rb, line 83
def options
  %w[
    -fs-mirror
    -net-mirror
    -platform
  ] + super
end
subcommands() click to toggle source

@!visibility private

# File lib/ruby_terraform/commands/providers_lock.rb, line 78
def subcommands
  %w[providers lock]
end