aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-23 13:02:47 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-23 21:16:39 +0100
commitec1039c336a9b3f796b3d805312f3b2dc0a0157c (patch)
tree4b58fdd56e1297556a185e8e91c3a7aee11b3dad /app/models
parent7bc196dabd3186793880c6d833392e8d8da3d191 (diff)
downloadgovuk-mini-environment-admin-ec1039c336a9b3f796b3d805312f3b2dc0a0157c.tar
govuk-mini-environment-admin-ec1039c336a9b3f796b3d805312f3b2dc0a0157c.tar.gz
Support refreshing the state of backends
Diffstat (limited to 'app/models')
-rw-r--r--app/models/backends/terraform_aws/backend_methods.rb11
-rw-r--r--app/models/backends/terraform_libvirt/backend_methods.rb14
2 files changed, 25 insertions, 0 deletions
diff --git a/app/models/backends/terraform_aws/backend_methods.rb b/app/models/backends/terraform_aws/backend_methods.rb
index 8c867d9..f8338a4 100644
--- a/app/models/backends/terraform_aws/backend_methods.rb
+++ b/app/models/backends/terraform_aws/backend_methods.rb
@@ -55,6 +55,17 @@ module Backends::TerraformAws::BackendMethods
end
end
+ def refresh_backend_state
+ TerraformWorkingDirectory.new(
+ terraform_state_id,
+ 'terraform/aws/backend'
+ ).within_working_directory do
+ RubyTerraform.refresh(
+ vars: backend_terraform_variables
+ )
+ end
+ end
+
def destroy_backend
TerraformWorkingDirectory.new(
terraform_state_id,
diff --git a/app/models/backends/terraform_libvirt/backend_methods.rb b/app/models/backends/terraform_libvirt/backend_methods.rb
index 7595611..9507e2c 100644
--- a/app/models/backends/terraform_libvirt/backend_methods.rb
+++ b/app/models/backends/terraform_libvirt/backend_methods.rb
@@ -49,6 +49,20 @@ module Backends::TerraformLibvirt::BackendMethods
end
end
+ def refresh_backend_state
+ TerraformWorkingDirectory.new(
+ terraform_state_id,
+ 'terraform/libvirt/backend'
+ ).within_working_directory do
+ RubyTerraform.refresh(
+ vars: {
+ uri: uri,
+ domain: domain
+ }
+ )
+ end
+ end
+
def backend_terraform_states
TerraformState.where(
state_id: terraform_state_id