lib/terragov/terraform.rb in terragov-0.3.1 vs lib/terragov/terraform.rb in terragov-0.3.1.1
- old
+ new
@@ -21,19 +21,23 @@
if command == 'init'
puts "Running 'init' is not required as it is applied for each command"
exit 1
end
+ current_dir = Dir.pwd
+
Dir.chdir directory
init(backend, dryrun, verbose)
if command == 'plan'
command = 'plan -detailed-exitcode'
end
full_command = "bash -c 'terraform #{command} #{vars}'"
run(full_command, dryrun, verbose)
+
+ Dir.chdir current_dir
end
def init(backend_file, dryrun = false, verbose = false)
init_cmd = "terraform init -backend-config #{backend_file}"
run(init_cmd, dryrun, verbose)