Class: Terracop::PlanLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/terracop/plan_loader.rb

Overview

Loads a Terraform plan file and transforms it into a Terracop-friendly list of instances.

Class Method Summary collapse

Class Method Details

.load(file) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/terracop/plan_loader.rb', line 8

def load(file)
  plan = decode(file)

  changed_resources = plan['resource_changes'].reject! do |resource|
    resource['change']['actions'] == ['no-op'] ||
      resource['change']['actions'] == ['delete']
  end

  restruct_resources(changed_resources)
end