diff options
author | Christopher Baines <mail@cbaines.net> | 2018-03-21 07:41:20 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-03-29 07:59:01 +0100 |
commit | 54b28b0c0ee3f71e8f4997d22aea19adeedcb11a (patch) | |
tree | b53d75658dd3199379892d4254c6d41f7651b0e7 /app/controllers | |
parent | cd8e1dad2f8c73b9d35f5bc997c44470bd2268ae (diff) | |
download | govuk-mini-environment-admin-54b28b0c0ee3f71e8f4997d22aea19adeedcb11a.tar govuk-mini-environment-admin-54b28b0c0ee3f71e8f4997d22aea19adeedcb11a.tar.gz |
Improve AWS backend support
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/backends/terraform_aws_controller.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/controllers/backends/terraform_aws_controller.rb b/app/controllers/backends/terraform_aws_controller.rb index b7f10ef..72c7e3a 100644 --- a/app/controllers/backends/terraform_aws_controller.rb +++ b/app/controllers/backends/terraform_aws_controller.rb @@ -1,7 +1,41 @@ class Backends::TerraformAwsController < ApplicationController def new + @backend = Backends::TerraformAws.new + end + + def create + backend = Backends::TerraformAws.create(backend_params) + + flash[:success] = "#{backend.label} created" + + redirect_to setup_path + end + + def update + backend = Backends::TerraformAws.update(params[:id], backend_params) + + flash[:success] = "#{backend.label} updated" end def show + @backend = Backends::TerraformAws.find(params[:id]) + end + + def destroy + backend = Backends::TerraformAws.find(params[:id]) + + backend.delete + end + + private + + def backend_params + params + .permit( + :label, + :aws_region, + :aws_access_key_id, + :aws_secret_access_key, + ) end end |