module RSpec::Terraspace::Concern
Public Instance Methods
out_path()
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 21 def out_path "#{Terraspace.tmp_root}/rspec/terraform-output.json" end
output(mod, name)
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 5 def output(mod, name) outputs.dig(name, "value") end
outputs()
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 9 def outputs save_output JSON.load(IO.read(out_path)) end
save_output()
click to toggle source
Note: a terraspace.down will remove the output.json since it does a clean
# File lib/rspec/terraspace/concern.rb, line 15 def save_output FileUtils.mkdir_p(File.dirname(out_path)) run("output #{@mod.name} --format json --out #{out_path}") end
save_state()
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 39 def save_state FileUtils.mkdir_p(File.dirname(state_path)) run("state pull #{@mod.name} > #{state_path}") end
state()
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 25 def state save_state JSON.load(IO.read(state_path)) end
state_path()
click to toggle source
# File lib/rspec/terraspace/concern.rb, line 45 def state_path "#{Terraspace.tmp_root}/rspec/terraform-state.json" end
state_resource(full_name)
click to toggle source
full_name: random_pet.this
# File lib/rspec/terraspace/concern.rb, line 31 def state_resource(full_name) type, name = full_name.split('.') state['resources'].find do |i| i['type'] == type && i['name'] == name || # IE: type=random_pet name=this i['module'] == full_name # IE: module.bucket end end