class YleTf::Backend
Constants
- BACKEND_CONFIG_FILE
Attributes
config[R]
Public Class Methods
new(config)
click to toggle source
# File lib/yle_tf/backend.rb, line 11 def initialize(config) @config = config end
Public Instance Methods
backend_specific_config()
click to toggle source
# File lib/yle_tf/backend.rb, line 19 def backend_specific_config config.fetch('backend', type) end
configure()
click to toggle source
Generate backend configuration file for Terraform
# File lib/yle_tf/backend.rb, line 24 def configure data = { terraform: [{ backend: [to_h] }] } File.write(BACKEND_CONFIG_FILE, JSON.pretty_generate(data)) end
tear_down()
click to toggle source
Tear down the backend
# File lib/yle_tf/backend.rb, line 34 def tear_down # Nothing to do by default end
to_h()
click to toggle source
Returns the backend configuration as a `Hash` for Terraform
# File lib/yle_tf/backend.rb, line 39 def to_h { type => backend_specific_config } end
to_s()
click to toggle source
# File lib/yle_tf/backend.rb, line 43 def to_s to_h.to_s end
type()
click to toggle source
# File lib/yle_tf/backend.rb, line 15 def type @type ||= config.fetch('backend', 'type') end