aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-05-03 21:22:23 +0100
committerChristopher Baines <mail@cbaines.net>2018-05-03 21:22:23 +0100
commitef74e10de2a27fef0a39ebee2e4c0b503689c0f1 (patch)
treeed169c028fe96da961da105eee80547d6549be22 /lib
parent541f55bb1a02ab27ce0152600689a4a210347532 (diff)
downloadgovuk-mini-environment-admin-ef74e10de2a27fef0a39ebee2e4c0b503689c0f1.tar
govuk-mini-environment-admin-ef74e10de2a27fef0a39ebee2e4c0b503689c0f1.tar.gz
Clear out terraform working directories during development
Diffstat (limited to 'lib')
-rw-r--r--lib/terraform_working_directory.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/terraform_working_directory.rb b/lib/terraform_working_directory.rb
index b561edf..38df0c7 100644
--- a/lib/terraform_working_directory.rb
+++ b/lib/terraform_working_directory.rb
@@ -31,6 +31,13 @@ class TerraformWorkingDirectory
end
def within_working_directory
+ if Rails.env.development? && Dir.exist?(working_directory)
+ # For the purposes of development, always clear the working
+ # directory. This ensures that fresh terraform configuration
+ # will be copied over
+ FileUtils.remove_dir(working_directory)
+ end
+
source = File.expand_path(@source)
FileUtils.mkdir_p working_directory