class GeoEngineer::Resources::AwsLambdaAlias

AwsLambdaAlias is the aws_lambda_function terrform resource,

{www.terraform.io/docs/providers/aws/r/lambda_alias.html Terraform Docs}

Public Class Methods

_fetch_aliases(provider, function) click to toggle source

TODO(Brad) - May need to implement solution for pagination…

# File lib/geoengineer/resources/aws_lambda_alias.rb, line 46
def self._fetch_aliases(provider, function)
  options = { function_name: function[:function_name] }
  AwsClients.lambda(provider).list_aliases(options)[:aliases].map(&:to_h).map do |f_alias|
    geo_id_components = [f_alias[:name], function[:function_arn], f_alias[:function_version]]
    f_alias.merge(
      {
        _terraform_id: f_alias[:alias_arn],
        _geo_id: geo_id_components.join('::')
      }
    )
  end
end
_fetch_functions(provider) click to toggle source

TODO(Brad) - May need to implement solution for pagination…

# File lib/geoengineer/resources/aws_lambda_alias.rb, line 38
def self._fetch_functions(provider)
  AwsClients
    .lambda(provider)
    .list_functions['functions']
    .map(&:to_h)
end
_fetch_remote_resources(provider) click to toggle source
# File lib/geoengineer/resources/aws_lambda_alias.rb, line 59
def self._fetch_remote_resources(provider)
  _fetch_functions(provider)
    .map { |function| _fetch_aliases(provider, function) }
    .flatten
    .compact
end

Public Instance Methods

support_tags?() click to toggle source
# File lib/geoengineer/resources/aws_lambda_alias.rb, line 24
def support_tags?
  false
end
to_terraform_state() click to toggle source
# File lib/geoengineer/resources/aws_lambda_alias.rb, line 28
def to_terraform_state
  tfstate = super
  tfstate[:primary][:attributes] = {
    'function_name' => function_name,
    'name' => name
  }
  tfstate
end