diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-21 22:59:14 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-21 22:59:14 +0100 |
commit | 948db9ae33a1a2e84588128c5e2c7b9c6b8e7de5 (patch) | |
tree | a083ba70f365cc755c5c02a1be80475a6a53388c /app | |
parent | aba93e2f5ccb730af47997b491cc2b39df010a17 (diff) | |
download | govuk-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.rb | 13 |
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 |