Class: RubyTerraform::Commands::Destroy
- Defined in:
- lib/ruby_terraform/commands/destroy.rb
Instance Method Summary collapse
Methods inherited from Base
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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby_terraform/commands/destroy.rb', line 7 def configure_command(builder, opts) directory = opts[:directory] vars = opts[:vars] || {} var_file = opts[:var_file] var_files = opts[:var_files] || [] target = opts[:target] targets = opts[:targets] || [] state = opts[:state] force = opts[:force] no_backup = opts[:no_backup] backup = no_backup ? '-' : opts[:backup] no_color = opts[:no_color] builder .with_subcommand('destroy') 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('-target', target) if target targets.each do |target_name| sub = sub.with_option('-target', target_name) end sub = sub.with_option('-state', state) if state sub = sub.with_option('-backup', backup) if backup sub = sub.with_flag('-no-color') if no_color sub = sub.with_flag('-force') if force sub end .with_argument(directory) end |