aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-03 14:16:58 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-03 14:16:58 +0100
commitc087576f60213b3dce45074b79b13c752f070d5c (patch)
treea4d7c2e2092538c99a4dd16b06217ef462e8ebdc /app
parentd5616c7f0f9f36d640ad60a69d3b235efabe77e4 (diff)
downloadgovuk-mini-environment-admin-c087576f60213b3dce45074b79b13c752f070d5c.tar
govuk-mini-environment-admin-c087576f60213b3dce45074b79b13c752f070d5c.tar.gz
Add support for destroying Terraform AWS backends
Diffstat (limited to 'app')
-rw-r--r--app/models/backends/terraform_aws.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/backends/terraform_aws.rb b/app/models/backends/terraform_aws.rb
index 204eaf0..299b5b5 100644
--- a/app/models/backends/terraform_aws.rb
+++ b/app/models/backends/terraform_aws.rb
@@ -127,6 +127,18 @@ class Backends::TerraformAws < ApplicationRecord
end
end
+ def destroy_backend
+ TerraformWorkingDirectory.new(
+ terraform_state_id,
+ 'terraform/aws/backend'
+ ).within_working_directory do
+ RubyTerraform.destroy(
+ vars: backend_terraform_variables,
+ force: true
+ )
+ end
+ end
+
def available_data_snapshots
GovukGuix::DataSnapshot.where(backend: self)
end