class SparkleFormation::Resources::Terraform

Terraform specific resources collection

Constants

RESOURCE_TYPE_NAMESPACE_SPLITTER

String to split for resource namespacing

Public Class Methods

included(_klass) click to toggle source

Auto load data when included

# File lib/sparkle_formation/resources/terraform.rb, line 53
def included(_klass)
  load!
end
key_loader(key) click to toggle source

Load namespaced file

@param key [String, Symbol] @return [TrueClass]

# 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!() click to toggle source

Load the builtin Terraform resources

@return [TrueClass]

# 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