aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/terraform_http_backend_controller.rb
blob: 6b94d8d66d041a6d73fa3d4d115b193d0b1bf415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class TerraformHttpBackendController < ApplicationController
  skip_before_action :verify_authenticity_token

  def create
    TerraformState.create(data: params)

    render json: '{ "success": true }', status: 200
  end

  def show
    state = TerraformState.last

    if state.nil?
      render json: '{}', status: 404
    else
      render json: state.data, status: 200
    end
  end

  def destroy
    TerraformState.delete_all

    render json: '{ "success": true }', status: 200
  end
end