aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/backends/terraform_aws_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/backends/terraform_aws_controller.rb')
-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