<%# GOV.UK Mini Environment Admin Copyright © 2018 Christopher Baines This file is part of the GOV.UK Mini Environment Admin. The GOV.UK Mini Environment Admin is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The GOV.UK Mini Environment Admin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with the GOV.UK Mini Environment Admin. If not, see . %> View all terraform states <% historical_states = TerraformState .where(state_id: @state.state_id) .order(id: :asc) .to_a %>

Terraform state: <%= @state.state_id %>

View raw JSON
Created at <%= @state.created_at %>
Terraform version <%= @state.data['terraform_version'] %>

History (<%= pluralize(historical_states.count, 'states') %>)

<% historical_states.to_enum.with_index.reverse_each do |historical_state, index| %> <% current = (@state.id == historical_state.id) %> <% end %>
# Created at
<%= index %> <% if current %> (current) <% end %> <%= historical_state.created_at %> <% unless current %> View <% end %>

Modules

<% @state.data.fetch('modules', []).each do |module_data| %>

Path: <%= module_data['path'] %>

Outputs

<% module_data['outputs'].each do |(key, output)| %> <% end %>
<%= key %> <%= output['value'] %>

Resources

<% module_data['resources'].each do |(name, resource)| %> <% end %>
<%= name.gsub('.', '.').html_safe %> <% resource['primary']['attributes'].each do |(name, value)| %> <% end %>
Key Value
<%= name %> <%= value %>
<% end %>