Class: SparkleFormation::Resources::Terraform

Inherits:
SparkleFormation::Resources show all
Extended by:
Bogo::Memoization
Defined in:
lib/sparkle_formation/resources/terraform.rb

Overview

Terraform specific resources collection

Constant Summary collapse

RESOURCE_TYPE_NAMESPACE_SPLITTER =

String to split for resource namespacing

["_"]

Constants inherited from SparkleFormation::Resources

PROPERTY_UPDATE_CONDITIONALS, RESOURCE_TYPE_TR

Class Method Summary collapse

Methods inherited from SparkleFormation::Resources

base_key, load, lookup, register, registry, registry_key, resource, resource_customizer, resource_lookup, resource_type_splitter

Methods included from Utils::AnimalStrings

#camel, #snake

Class Method Details

.included(_klass) ⇒ Object

Auto load data when included



53
54
55
# File 'lib/sparkle_formation/resources/terraform.rb', line 53

def included(_klass)
  load!
end

.key_loader(key) ⇒ TrueClass

Load namespaced file

Parameters:

  • key (String, Symbol)

Returns:

  • (TrueClass)


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/sparkle_formation/resources/terraform.rb', line 40

def key_loader(key)
  prefix = key.to_s.split("_").first
  memoize("terraform_#{prefix}_resources".to_sym, :global) do
    file_path = File.join(
      File.dirname(__FILE__),
      "terraform_#{prefix}_resources.json"
    )
    load(file_path) if File.exist?(file_path)
    true
  end
end

.load!TrueClass

Load the builtin Terraform resources

Returns:

  • (TrueClass)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sparkle_formation/resources/terraform.rb', line 20

def load!
  memoize(:terraform_resources, :global) do
    load(
      File.join(
        File.dirname(__FILE__),
        "terraform_resources.json"
      )
    )
    # NOTE: Internal resource type used for nesting
    register("module",
             "properties" => [],
             "full_properties" => {})
    true
  end
end