class BB8::Commands::Terraform
Attributes
arguments[R]
command[R]
environment[R]
Public Class Methods
call(environment, command, *arguments)
click to toggle source
# File lib/bb8/commands/terraform.rb, line 2 def self.call(environment, command, *arguments) new(environment, command, *arguments).call end
new(environment, command, *arguments)
click to toggle source
# File lib/bb8/commands/terraform.rb, line 6 def initialize(environment, command, *arguments) @environment, @command, @arguments = environment, command, arguments end
Public Instance Methods
call()
click to toggle source
# File lib/bb8/commands/terraform.rb, line 10 def call `git pull origin` Dir.chdir environment BB8::SetEncryptionKeys.call `cp ../common.tf common.tf` if File.exist?('../common.tf') Dir['*.enc'].each { |path| BB8::Decrypt.call path } system "terraform #{command} #{arguments.join(' ')}" Dir['*.tfvars'].each { |path| BB8::Encrypt.call path } Dir['*.tfstate'].each { |path| BB8::Encrypt.call path } Dir['*.tfstate.backup'].each { |path| BB8::Encrypt.call path } Dir.chdir '..' `git add .` `git commit -m "[bb8] Update Terraform files after running #{command}"` `git push origin` end
Private Instance Methods
voltos_bundle()
click to toggle source
# File lib/bb8/commands/terraform.rb, line 36 def voltos_bundle @voltos_bundle ||= File.read('.bb8_bundle') end