Class: RubyTerraform::Commands::RemoteConfig

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_terraform/commands/remote_config.rb

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize

Constructor Details

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

Instance Method Details

#configure_command(builder, opts) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_terraform/commands/remote_config.rb', line 7

def configure_command(builder, opts)
  backend = opts[:backend]
  no_color = opts[:no_color]
  backend_config = opts[:backend_config] || {}

  builder
      .with_subcommand('remote')
      .with_subcommand('config') do |sub|
        sub = sub.with_option('-backend', backend) if backend
        backend_config.each do |key, value|
          sub = sub.with_option(
              '-backend-config', "'#{key}=#{value}'", separator: ' ')
        end

        sub = sub.with_flag('-no-color') if no_color
        sub
      end
end