Sha256: 1b99279de03d0ebab9a43db8cc3c3d59805ba7f116e2a7dc3759d45672bef3f6
Contents?: true
Size: 823 Bytes
Versions: 5
Compression:
Stored size: 823 Bytes
Contents
class Terraspace::Terraform::Api class Vars extend Memoist include Client def initialize(mod, workspace) @mod, @workspace = mod, workspace end def run return unless exist? vars = vars_class.new(@mod, vars_path).vars vars.each do |attrs| Var.new(@workspace, attrs).sync end end # Return value examples: # # Terraspace::Terraform::Api::Vars::Json # Terraspace::Terraform::Api::Vars::Rb # def vars_class ext = File.extname(vars_path).sub('.','') "Terraspace::Terraform::Api::Vars::#{ext.camelize}".constantize end def exist? !!vars_path end def vars_path # .rb takes higher precedence Dir.glob("#{Terraspace.root}/config/terraform/cloud/vars.{rb,json}").first end end end
Version data entries
5 entries across 5 versions & 1 rubygems