infrablocks / ruby_terraform

A simple Ruby wrapper for invoking terraform commands.
MIT License
109 stars 33 forks source link

Error is produced when RubyTerraform.configure is not run #1

Closed timurb closed 7 years ago

timurb commented 7 years ago

When I don't run RubyTerraform.configure in the beginning the first invocation fails with the following error:

     NoMethodError:
       undefined method `binary' for nil:NilClass
     # ./vendor/bundle/ruby/2.0.0/gems/ruby-terraform-0.5.0/lib/ruby_terraform/commands/base.rb:9:in `initialize'
     # ./vendor/bundle/ruby/2.0.0/gems/ruby-terraform-0.5.0/lib/ruby_terraform.rb:24:in `new'
     # ./vendor/bundle/ruby/2.0.0/gems/ruby-terraform-0.5.0/lib/ruby_terraform.rb:24:in `get'
     # ./spec/main_spec.rb:5:in `block (2 levels) in <top (required)>'

This happens because @configuration is set by running RubyTerraform.configure and before that it is still nil.

If I add the following snippet at the top of the file all works like expected:

RubyTerraform.configure {}
tobyclemson commented 7 years ago

Thanks for the detailed issue - I'll take a look now.

tobyclemson commented 7 years ago

Ok, I just release 0.5.1 which resolves this issue.

I'll close this issue now but feel free to reopen if you are still having problems.

timurb commented 7 years ago

Seems to work fine for me, thank you for the quick fixing!