Class: YleTfPlugins::Backends::File::Command
- Inherits:
-
Object
- Object
- YleTfPlugins::Backends::File::Command
- Defined in:
- lib/yle_tf_plugins/backends/file/command.rb
Instance Method Summary collapse
Instance Method Details
#backend_config(config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/yle_tf_plugins/backends/file/command.rb', line 7 def backend_config(config) local_path = Pathname.pwd.join('terraform.tfstate') tfstate_path = tfstate_path(config) YleTf::Logger.info("Symlinking state to '#{tfstate_path}'") local_path.make_symlink(tfstate_path) tfstate_path.write(tfstate_template, perm: 0o644) if !tfstate_path.exist? Config.new( 'file', 'file' => tfstate_path.to_s ) end |
#tfstate_path(config) ⇒ Object
21 22 23 |
# File 'lib/yle_tf_plugins/backends/file/command.rb', line 21 def tfstate_path(config) config.module_dir.join(config.fetch('backend', 'file')) end |
#tfstate_template ⇒ Object
25 26 27 |
# File 'lib/yle_tf_plugins/backends/file/command.rb', line 25 def tfstate_template '{"version": 1}' end |