Sha256: af0587ec52482deb53731f727a57ca04b50e701db51052a25c798ee43ffe7f25

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module RubyTerraform
  class Output
    class << self
      def for(opts)
        Dir.chdir(create_config_directory(opts)) do
          RubyTerraform.init(backend_config: opts[:backend_config])
          RubyTerraform.output(name: opts[:name])
        end
      end

      private

      def create_config_directory(opts)
        source_directory = opts[:source_directory]
        work_directory = opts[:work_directory]

        configuration_directory = File.join(work_directory, source_directory)
        FileUtils.mkdir_p File.dirname(configuration_directory)
        FileUtils.cp_r source_directory, configuration_directory

        configuration_directory
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-terraform-0.65.0.pre.9 lib/ruby_terraform/output.rb