class Terraforming::Resource::RouteTableAssociation
Public Class Methods
new(client)
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 14 def initialize(client) @client = client end
tf(client: Aws::EC2::Client.new)
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 6 def self.tf(client: Aws::EC2::Client.new) self.new(client).tf end
tfstate(client: Aws::EC2::Client.new)
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 10 def self.tfstate(client: Aws::EC2::Client.new) self.new(client).tfstate end
Public Instance Methods
tf()
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 18 def tf apply_template(@client, "tf/route_table_association") end
tfstate()
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 22 def tfstate resources = {} route_tables.each do |route_table| associations_of(route_table).each do |assoc| attributes = { "id" => assoc.route_table_association_id, "route_table_id" => assoc.route_table_id, "subnet_id" => assoc.subnet_id, } resources["aws_route_table_association.#{module_name_of(route_table, assoc)}"] = { "type" => "aws_route_table_association", "primary" => { "id" => assoc.route_table_association_id, "attributes" => attributes } } end end resources end
Private Instance Methods
associations_of(route_table)
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 46 def associations_of(route_table) route_table.associations.reject { |association| association.subnet_id.nil? } end
module_name_of(route_table, assoc)
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 50 def module_name_of(route_table, assoc) normalize_module_name(name_from_tag(route_table, route_table.route_table_id) + '-' + assoc.route_table_association_id) end
route_tables()
click to toggle source
# File lib/terraforming/resource/route_table_association.rb, line 54 def route_tables @client.describe_route_tables.map(&:route_tables).flatten end