lib/terraspace/compiler/backend.rb in terraspace-0.3.2 vs lib/terraspace/compiler/backend.rb in terraspace-0.3.3

- old
+ new

@@ -4,15 +4,25 @@ def initialize(mod) @mod = mod end + @@created = {} def create + return if @@created[cache_key] + # set immediately, since local storage wont reach bottom. + # if fail for other backends, there will be an exception anyway + @@created[cache_key] = true + klass = backend_interface(backend_name) return unless klass # in case auto-creation is not supported for specific backend interface = klass.new(backend_info) interface.call + end + + def cache_key + @mod.build_dir end def backend_name backend.keys.first # IE: s3, gcs, etc end