Sha256: 9bff79d3a2f10991d81637a3af53501be97ccc6d21fe872116beab4234df868d

Contents?: true

Size: 1.31 KB

Versions: 17

Compression:

Stored size: 1.31 KB

Contents

require 'lino'
require_relative 'base'

module RubyTerraform
  module Commands
    class Validate < Base
      def configure_command(builder, opts)
        directory = opts[:directory]
        vars = opts[:vars] || {}
        var_file = opts[:var_file]
        var_files = opts[:var_files] || []
        state = opts[:state]
        check_variables = opts[:check_variables]
        no_color = opts[:no_color]
        json_format = opts[:json]

        builder
            .with_subcommand('validate') do |sub|
              vars.each do |key, value|
                var_value = value.is_a?(String) ? value : JSON.generate(value)
                sub = sub.with_option(
                    '-var', "'#{key}=#{var_value}'", separator: ' ')
              end
              sub = sub.with_option('-var-file', var_file) if var_file
              var_files.each do |file|
                sub = sub.with_option('-var-file', file)
              end
              sub = sub.with_option('-state', state) if state
              sub = sub.with_option('-check-variables', check_variables) unless
                  check_variables.nil?
              sub = sub.with_flag('-no-color') if no_color
              sub = sub.with_flag('-json') if json_format
              sub
            end
            .with_argument(directory)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ruby-terraform-0.64.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.63.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.62.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.61.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.60.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.59.0.pre.2 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.59.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.58.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.57.0.pre.2 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.57.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.56.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.55.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.54.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.53.0.pre.2 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.53.0.pre.1 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.52.0 lib/ruby_terraform/commands/validate.rb
ruby-terraform-0.51.0.pre.3 lib/ruby_terraform/commands/validate.rb