aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-21 23:11:11 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-21 23:11:11 +0100
commit8e19306b741e54b08ea97c8e6d94458b832ddd63 (patch)
tree7b079bc26d1da64377535f599b3f429053b167a5
parent4c6b3b725275eaa8a87c22c56e0086722e7a7748 (diff)
downloadgovuk-mini-environment-admin-8e19306b741e54b08ea97c8e6d94458b832ddd63.tar
govuk-mini-environment-admin-8e19306b741e54b08ea97c8e6d94458b832ddd63.tar.gz
Add a refresh action to the MiniEnvironment class
This can then be used to update the Terraform state for the Mini Environment.
-rw-r--r--app/models/backends/terraform_libvirt/mini_environment_methods.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/backends/terraform_libvirt/mini_environment_methods.rb b/app/models/backends/terraform_libvirt/mini_environment_methods.rb
index b89a07f..c931a5d 100644
--- a/app/models/backends/terraform_libvirt/mini_environment_methods.rb
+++ b/app/models/backends/terraform_libvirt/mini_environment_methods.rb
@@ -63,6 +63,14 @@ module Backends::TerraformLibvirt::MiniEnvironmentMethods
end
end
+ def refresh(mini_environment)
+ within_terraform_working_directory(mini_environment) do
+ RubyTerraform.refresh(
+ vars: terraform_variables(mini_environment)
+ )
+ end
+ end
+
def terraform_states(mini_environment)
TerraformState.where(
state_id: mini_environment_state_id(mini_environment)