M #-: add file exist check in Terraform state (#854)

This commit is contained in:
Alejandro Huertas Herrero authored and GitHub committed 2021-02-22 18:26:46 +01:00
1 parent ce6dae6163
commit 5359b5c548
1 file changed
+7 -3
+7 -3
View File
@@ -151,9 +151,13 @@ module OneProvision
)
unless s && s.success?
@state = File.read("#{tempdir}/terraform.tfstate")
conf = Base64.encode64(Zlib::Deflate.deflate(@conf))
state = Base64.encode64(Zlib::Deflate.deflate(@state))
conf = Base64.encode64(Zlib::Deflate.deflate(@conf))
state = ''
if File.exist?("#{tempdir}/terraform.tfstate")
@state = File.read("#{tempdir}/terraform.tfstate")
state = Base64.encode64(Zlib::Deflate.deflate(@state))
end
provision.add_tf(state, conf)