Class: Ruby::Terraform::Commands::InitCommand
- Inherits:
-
Object
- Object
- Ruby::Terraform::Commands::InitCommand
- Includes:
- ExecutionSupport
- Defined in:
- lib/ruby/terraform/commands/init_command.rb
Instance Attribute Summary collapse
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#backend_config ⇒ Object
Returns the value of attribute backend_config.
-
#dir ⇒ Object
Returns the value of attribute dir.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(opts = {}) ⇒ InitCommand
constructor
A new instance of InitCommand.
Methods included from ExecutionSupport
Constructor Details
#initialize(opts = {}) ⇒ InitCommand
Returns a new instance of InitCommand.
11 12 13 14 15 |
# File 'lib/ruby/terraform/commands/init_command.rb', line 11 def initialize(opts = {}) @dir = opts[:dir] @backend = opts[:backend] @backend_config = opts[:backend_config] end |
Instance Attribute Details
#backend ⇒ Object
Returns the value of attribute backend.
8 9 10 |
# File 'lib/ruby/terraform/commands/init_command.rb', line 8 def backend @backend end |
#backend_config ⇒ Object
Returns the value of attribute backend_config.
9 10 11 |
# File 'lib/ruby/terraform/commands/init_command.rb', line 9 def backend_config @backend_config end |
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/ruby/terraform/commands/init_command.rb', line 7 def dir @dir end |
Instance Method Details
#command ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby/terraform/commands/init_command.rb', line 17 def command cmd = %W[#{tf_binary} init] cmd += ['-backend', backend] if backend if backend_config backend_config.each do |key, value| cmd += ['-backend-config', "#{key}=#{value}"] end end cmd += [dir] if dir cmd end |