class GeoEngineer::Resources::AwsMainRouteTableAssociation

AwsMainRouteTableAssociation is the aws_main_route_table_association terrform resource,

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

Public Class Methods

_extract_associations(route_table) click to toggle source
# File lib/geoengineer/resources/aws_main_route_table_association.rb, line 46
def self._extract_associations(route_table)
  route_table[:associations].map do |association|
    association.merge({ vpc_id: route_table[:vpc_id] })
  end
end
_fetch_remote_resources(provider) click to toggle source
# File lib/geoengineer/resources/aws_main_route_table_association.rb, line 25
def self._fetch_remote_resources(provider)
  AwsClients
    .ec2(provider)
    .describe_route_tables['route_tables']
    .map(&:to_h)
    .select { |route_table| route_table[:associations] }
    .map { |route_table| _extract_associations(route_table) }
    .flatten
    .select { |association| association[:main] }
    .map { |association| _merge_ids(association) }
end
_merge_ids(association) click to toggle source
# File lib/geoengineer/resources/aws_main_route_table_association.rb, line 37
def self._merge_ids(association)
  association.merge(
    {
      _terraform_id: association[:route_table_association_id],
      _geo_id: "#{association[:vpc_id]}::#{association[:route_table_id]}"
    }
  )
end

Public Instance Methods

support_tags?() click to toggle source
# File lib/geoengineer/resources/aws_main_route_table_association.rb, line 21
def support_tags?
  false
end
to_terraform_state() click to toggle source
# File lib/geoengineer/resources/aws_main_route_table_association.rb, line 12
def to_terraform_state
  tfstate = super
  tfstate[:primary][:attributes] = {
    'vpc_id' => vpc_id,
    'route_table_id' => route_table_id
  }
  tfstate
end