Class: SparkleFormation::SparkleStruct::Terraform

Inherits:
SparkleFormation::SparkleStruct show all
Includes:
SparkleFormation::SparkleAttribute, SparkleFormation::SparkleAttribute::Terraform
Defined in:
lib/sparkle_formation/sparkle_struct.rb

Overview

Terraform specific struct

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from SparkleFormation::SparkleStruct

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SparkleFormation::SparkleStruct

Instance Method Details

#__attribute_key(key) ⇒ String Originally defined in module SparkleFormation::SparkleAttribute

Format the provided key. If symbol type is provided formatting is forced. Otherwise the default formatting is applied

Parameters:

  • key (String, Symbol)

    given key

Returns:

  • (String)

    formatted key

#__resource_lookup(name) ⇒ String Originally defined in module SparkleFormation::SparkleAttribute::Terraform

Lookup resource based on name and provide formatted reference to the resource with type included.

Parameters:

  • name (String, Symbol)

    resource name

Returns:

  • (String)

    resource name

#_depends_on(resource_name) ⇒ Array<String> #_depends_on(resource_names) ⇒ Array<String> #_depends_on(*resource_names) ⇒ Array<String> Also known as: depends_on! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

Note:

this will directly modify the struct at its current context to inject depends on structure

Resource dependency generator

Overloads:

  • #_depends_on(resource_name) ⇒ Array<String>

    Parameters:

    • resource_name (String, Symbol)

      logical resource name

  • #_depends_on(resource_names) ⇒ Array<String>

    Parameters:

    • resource_names (Array<String, Symbol>)

      list of logical resource names

  • #_depends_on(*resource_names) ⇒ Array<String>

    Parameters:

    • resource_names (Array<String, Symbol>)

      list of logical resource names

Returns:

  • (Array<String>)

#_dynamic(resource_type, custom_name, options = {}) ⇒ self #_dynamic(dynamic_name, custom_name, options = {}) ⇒ self Also known as: dynamic! Originally defined in module SparkleFormation::SparkleAttribute

Overloads:

  • #_dynamic(resource_type, custom_name, options = {}) ⇒ self
    Note:

    All other options are set into the new resource's properties

    Insert builtin resource

    Parameters:

    • resource_type (String, Symbol)

      provider resource type

    • custom_name (String, Symbol)

      custom name used for resource name generation

    • options (Hash) (defaults to: {})

    Options Hash (options):

    • :resource_name_suffix (String, NilClass)

      custom suffix to use for name generation (defaults to resource_type)

  • #_dynamic(dynamic_name, custom_name, options = {}) ⇒ self
    Note:

    All options are passed to dynamic with custom_name

    Call custom dynamic from available sparkle packs

    Parameters:

    • dynamic_name (Symbol)

      name of registered dynamic

    • custom_name (Symbol, String)

      unique name passed directly to registered dynamic

    • options (Hash) (defaults to: {})

    Options Hash (options):

    • :provider (String, Symbol)

      override provider restriction when fetching dynamic

Yields:

  • (new_struct)

    Provides newly inserted structure

Yield Parameters:

  • new_struct (SparkleStruct)

    newly inserted structure which can be modified

Yield Returns:

  • (Object)

    discarded

Returns:

  • (self)

#_fn_format(*args) ⇒ SparkleFormation::FunctionStruct Originally defined in module SparkleFormation::SparkleAttribute::Terraform

Generate a builtin terraform function

#_method(sym) ⇒ Method Also known as: method! Originally defined in module SparkleFormation::SparkleAttribute

Note:

usually used as puts! method!(:foo).source_location

Lookup a method definition on self

Parameters:

  • sym (Symbol)

    name of method

Returns:

  • (Method)

See Also:

  • Object#method

#_module(m_name) ⇒ Object Also known as: module! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

#_nest(template, *names, options = {}) ⇒ self Also known as: nest! Originally defined in module SparkleFormation::SparkleAttribute

Nest a stack resource

Parameters:

  • template (String, Symbol)

    name of desired template

  • names (String, Symbol)

    list of optional string/symbol values for resource name generation

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :provider (String, Symbol)

    override provider restriction when fetching template

  • :overwrite_name (Truthy, Falsey)

    when set to true, will not include template name in resource name

  • :parameters (Hash)

    compile time parameter values to pass to nested template

Yields:

  • (new_struct)

    Provides newly inserted structure

Yield Parameters:

  • new_struct (SparkleStruct)

    newly inserted structure which can be modified

Yield Returns:

  • (Object)

    discarded

Returns:

  • (self)

#_path(p_name) ⇒ Object Also known as: path! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

#_puts(obj, ...) ⇒ NilClass Also known as: puts! Originally defined in module SparkleFormation::SparkleAttribute

Print to stdout

Parameters:

  • obj (Object)

    object to print

Returns:

  • (NilClass)

See Also:

  • Kernel.puts

#_raise(*args) ⇒ Object Also known as: raise! Originally defined in module SparkleFormation::SparkleAttribute

Raise an exception

See Also:

  • Kernel.raise

#_registry(name) ⇒ Object #_registry(name, *args, options = {}) ⇒ Object Also known as: registry! Originally defined in module SparkleFormation::SparkleAttribute

Return value of registry item

Overloads:

  • #_registry(name) ⇒ Object

    Return value from registry item with given name

    Parameters:

    • name (String, Symbol)

      registry item name

  • #_registry(name, *args, options = {}) ⇒ Object
    Note:

    args and options will be passed directly to registry item when called

    Pass given parameters to registry item with given name and return the value

    Parameters:

    • name (String, Symbol)

      registry item name

    • options (Hash) (defaults to: {})
    • options (Hash) (defaults to: {})

      :provider override provider restriction when fetching registry item

    • args (Object)

      argument list

Returns:

  • (Object)

    return value of registry item

#_resource(r_name) ⇒ Object Also known as: resource! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

TODO: Add resource checking before returning structure

#_resource_nameString Also known as: resource_name! Originally defined in module SparkleFormation::SparkleAttribute

Return current resource name

Returns:

  • (String)

#_stack_output(stack_name, output_name) ⇒ Hash Also known as: stack_output! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

Reference output value from nested stack

Parameters:

  • stack_name (String, Symbol)

    logical resource name of stack

  • output_name (String, Symbol)

    stack output name

Returns:

  • (Hash)

#_system(command) ⇒ String Also known as: system! Originally defined in module SparkleFormation::SparkleAttribute

Execute system command

Parameters:

  • command (String)

Returns:

  • (String)

    result

#_terraform_lookup(*args) ⇒ Object Also known as: lookup! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

#_terraform_self(s_name) ⇒ Object Also known as: self! Originally defined in module SparkleFormation::SparkleAttribute::Terraform

#_var(v_name) ⇒ Object Also known as: var!, parameter! Originally defined in module SparkleFormation::SparkleAttribute::Terraform