aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-06-21 22:59:14 +0100
committerChristopher Baines <mail@cbaines.net>2018-06-21 22:59:14 +0100
commit948db9ae33a1a2e84588128c5e2c7b9c6b8e7de5 (patch)
treea083ba70f365cc755c5c02a1be80475a6a53388c /app
parentaba93e2f5ccb730af47997b491cc2b39df010a17 (diff)
downloadgovuk-mini-environment-admin-948db9ae33a1a2e84588128c5e2c7b9c6b8e7de5.tar
govuk-mini-environment-admin-948db9ae33a1a2e84588128c5e2c7b9c6b8e7de5.tar.gz
Add some methods to the TerraformState class
Diffstat (limited to 'app')
-rw-r--r--app/models/terraform_state.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/terraform_state.rb b/app/models/terraform_state.rb
index 2ea7c91..f047137 100644
--- a/app/models/terraform_state.rb
+++ b/app/models/terraform_state.rb
@@ -30,4 +30,17 @@
#
class TerraformState < ApplicationRecord
+ def data_for_module(path)
+ data['modules'].find { |x| x['path'] == path }
+ end
+
+ def outputs(module_path: ['root'])
+ data_for_module(module_path)['outputs']
+ end
+
+ def output_value(name, module_path: ['root'])
+ output = outputs(module_path: module_path)[name]
+
+ output['value'] if output
+ end
end