aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-04-07 15:27:38 +0100
committerChristopher Baines <mail@cbaines.net>2018-04-12 08:30:56 +0100
commit2e97d9f957eff4ba66f1c4c65ff0b5156471cf6c (patch)
tree7b55cfce7488fc59d75374e49850829f0931fb76 /app
parent13bf88b2e8e6cec0d2207fe7b92f7446eea49354 (diff)
downloadgovuk-mini-environment-admin-2e97d9f957eff4ba66f1c4c65ff0b5156471cf6c.tar
govuk-mini-environment-admin-2e97d9f957eff4ba66f1c4c65ff0b5156471cf6c.tar.gz
Change mini_environment_id to state_id on TerraformState
To allow supporting tracking related TerraformStates for backends as well.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/terraform_http_backend_controller.rb10
-rw-r--r--app/models/terraform_state.rb10
2 files changed, 10 insertions, 10 deletions
diff --git a/app/controllers/terraform_http_backend_controller.rb b/app/controllers/terraform_http_backend_controller.rb
index ceff807..e4d8c54 100644
--- a/app/controllers/terraform_http_backend_controller.rb
+++ b/app/controllers/terraform_http_backend_controller.rb
@@ -23,7 +23,7 @@ class TerraformHttpBackendController < ApplicationController
def create
TerraformState.create(
- mini_environment_id: mini_environment_id,
+ state_id: state_id,
data: params
)
@@ -32,7 +32,7 @@ class TerraformHttpBackendController < ApplicationController
def show
state = TerraformState.where(
- mini_environment_id: mini_environment_id
+ state_id: state_id
).last
if state.nil?
@@ -44,13 +44,13 @@ class TerraformHttpBackendController < ApplicationController
def destroy
TerraformState
- .where(mini_environment_id: mini_environment_id)
+ .where(state_id: state_id)
.delete_all
render json: '{ "success": true }', status: 200
end
- def mini_environment_id
- params[:mini_environment_id]
+ def state_id
+ params[:state_id]
end
end
diff --git a/app/models/terraform_state.rb b/app/models/terraform_state.rb
index fb2863f..2ea7c91 100644
--- a/app/models/terraform_state.rb
+++ b/app/models/terraform_state.rb
@@ -22,11 +22,11 @@
#
# Table name: terraform_states
#
-# id :integer not null, primary key
-# data :json
-# created_at :datetime not null
-# updated_at :datetime not null
-# mini_environment_id :integer
+# id :integer not null, primary key
+# data :json
+# created_at :datetime not null
+# updated_at :datetime not null
+# state_id :string default(""), not null
#
class TerraformState < ApplicationRecord