aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-23 11:40:52 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-23 21:16:39 +0100
commit7bc196dabd3186793880c6d833392e8d8da3d191 (patch)
tree027f3faffdfeda646cb4535b0df8c59e338c68a3 /app/controllers
parent76f7351c19777379d4d42a348a7f8da735a30649 (diff)
downloadgovuk-mini-environment-admin-7bc196dabd3186793880c6d833392e8d8da3d191.tar
govuk-mini-environment-admin-7bc196dabd3186793880c6d833392e8d8da3d191.tar.gz
Add support for managing Terraform AWS backends from the show page
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/backends/terraform_aws_controller.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/backends/terraform_aws_controller.rb b/app/controllers/backends/terraform_aws_controller.rb
index bffac9d..f11403f 100644
--- a/app/controllers/backends/terraform_aws_controller.rb
+++ b/app/controllers/backends/terraform_aws_controller.rb
@@ -55,6 +55,27 @@ class Backends::TerraformAwsController < ApplicationController
redirect_to setup_path
end
+ def perform_action
+ @backend = Backends::TerraformAws.find(params['id'])
+
+ action = params.require(:commit)
+
+ case action
+ when 'Destroy'
+ Backends::TerraformAwsJob.enqueue(@backend.id, :destroy_backend)
+
+ flash[:notice] = 'Destroying the backend'
+ when 'Deploy'
+ Backends::TerraformAwsJob.enqueue(@backend.id, :deploy_backend)
+
+ flash[:notice] = 'Deploying the backend'
+ else
+ flash[:error] = "Unknown action #{action}"
+ end
+
+ render 'show'
+ end
+
private
def create_params