Sha256: bc0b6f2b4cd147e5ff45522435a08c88980a3c70b7f77ad28f4416ebad9db8d9
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Kite class Terraform def initialize(core, options) @core = core @env_name = options[:env] end def run(command, *args) STDERR.puts "Loading env" load_env script = "terraform #{command} #{args.join " "}" STDERR.puts script Dir.chdir("config/environments/#{@env_name}") do system(script) end end def load_env load_vars @vars.each do |var, val| key = "TF_VAR_#{var}" ENV[key] = val STDERR.puts "%-25s: %s" % [key, ENV["TF_VAR_#{var}"]] end # TODO: Need to be set only in case of GCP # ENV['GOOGLE_APPLICATION_CREDENTIALS'] = @vars["credentials"] end def cloud YAML.load(File.read('config/cloud.yml'))[@env_name] end def load_vars vars_files = Dir["config/environments/#{@env_name}/vars.*.yml"] @vars = Hash.new vars_files.each do |f| tf_vars = YAML.load(File.read(f))['terraform'] @vars.merge!(tf_vars) unless tf_vars.nil? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kite-1.0.1 | lib/kite/terraform.rb |
kite-1.0.0 | lib/kite/terraform.rb |