Class: Biosphere::CLI::TerraformUtils
- Inherits:
-
Object
- Object
- Biosphere::CLI::TerraformUtils
- Defined in:
- lib/biosphere/cli/terraformutils.rb
Instance Method Summary collapse
-
#initialize ⇒ TerraformUtils
constructor
A new instance of TerraformUtils.
- #move(tfstate_file, resource_type, old_name, new_name) ⇒ Object
Constructor Details
#initialize ⇒ TerraformUtils
Returns a new instance of TerraformUtils.
7 8 9 |
# File 'lib/biosphere/cli/terraformutils.rb', line 7 def initialize() end |
Instance Method Details
#move(tfstate_file, resource_type, old_name, new_name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/biosphere/cli/terraformutils.rb', line 11 def move(tfstate_file, resource_type, old_name, new_name) if tfstate_file.nil? || resource_type.nil? || old_name.nil? || new_name.nil? puts "Can't run terraform mv without a tfstate_file, resource_type, old_resource_name and a new_resource_name" puts "tfstate_file: #{tfstate_file}" puts "resource_type: #{resource_type}" puts "old_name: #{old_name}" puts "new_name: #{new_name}" exit(-1) end begin PTY.spawn("terraform state mv -state=#{tfstate_file} #{resource_type}.#{old_name} #{resource_type}.#{new_name}") do |stdout, stdin, pid| begin stdout.each { |line| puts line } rescue Errno::EIO end end rescue PTY::ChildExited puts "The child process exited!" end end |