Class: Cloudspin::Stack::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudspin/stack/definition.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terraform_source_path: '', parameter_names: [], resource_names: []) ⇒ Definition



9
10
11
12
13
14
15
# File 'lib/cloudspin/stack/definition.rb', line 9

def initialize(terraform_source_path: '',
               parameter_names: [],
               resource_names: [])
  @terraform_source_path = terraform_source_path
  @parameter_names = parameter_names
  @resource_names = resource_names
end

Instance Attribute Details

#parameter_namesObject (readonly)

Returns the value of attribute parameter_names.



7
8
9
# File 'lib/cloudspin/stack/definition.rb', line 7

def parameter_names
  @parameter_names
end

#resource_namesObject (readonly)

Returns the value of attribute resource_names.



7
8
9
# File 'lib/cloudspin/stack/definition.rb', line 7

def resource_names
  @resource_names
end

#terraform_source_pathObject (readonly)

Returns the value of attribute terraform_source_path.



7
8
9
# File 'lib/cloudspin/stack/definition.rb', line 7

def terraform_source_path
  @terraform_source_path
end

Class Method Details

.from_file(specfile) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/cloudspin/stack/definition.rb', line 17

def self.from_file(specfile)
  raise "Cloudspin definition file not found: #{specfile}" unless File.exists?(specfile)
  spec_hash = YAML.load_file(specfile)
  stack_spec = symbolize(spec_hash)
  terraform_source_path = File.dirname(specfile)
  self.new(terraform_source_path: terraform_source_path, **stack_spec)
end