diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-23 22:51:48 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-23 22:51:48 +0100 |
commit | e5c3d2979282404e7d89b4facc4e4f138aa2ae1d (patch) | |
tree | adb62654cab677a40ad45ffc4423dd723e0bd1c4 /app/models/backends | |
parent | 1026a19ee13805c6cb44c676f0b648b06bf2efd2 (diff) | |
download | govuk-mini-environment-admin-e5c3d2979282404e7d89b4facc4e4f138aa2ae1d.tar govuk-mini-environment-admin-e5c3d2979282404e7d89b4facc4e4f138aa2ae1d.tar.gz |
Support 'Stopping' the AWS backend
Which means just destroying the build machine.
Diffstat (limited to 'app/models/backends')
-rw-r--r-- | app/models/backends/terraform_aws/backend_methods.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/backends/terraform_aws/backend_methods.rb b/app/models/backends/terraform_aws/backend_methods.rb index f8338a4..89509bd 100644 --- a/app/models/backends/terraform_aws/backend_methods.rb +++ b/app/models/backends/terraform_aws/backend_methods.rb @@ -78,6 +78,19 @@ module Backends::TerraformAws::BackendMethods end end + def stop_backend + TerraformWorkingDirectory.new( + terraform_state_id, + 'terraform/aws/backend' + ).within_working_directory do + RubyTerraform.destroy( + vars: backend_terraform_variables, + target: 'aws_spot_instance_request.main', + force: true + ) + end + end + def available_data_snapshots GovukGuix::DataSnapshot.where(backend: self) end |