Class: Terraforming::Resource::RouteTable
- Inherits:
-
Object
- Object
- Terraforming::Resource::RouteTable
show all
- Includes:
- Util
- Defined in:
- lib/terraforming/resource/route_table.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#apply_template, #name_from_tag, #normalize_module_name, #prettify_policy, #template_path
Constructor Details
#initialize(client) ⇒ RouteTable
Returns a new instance of RouteTable.
14
15
16
|
# File 'lib/terraforming/resource/route_table.rb', line 14
def initialize(client)
@client = client
end
|
Class Method Details
.tf(client: Aws::EC2::Client.new) ⇒ Object
6
7
8
|
# File 'lib/terraforming/resource/route_table.rb', line 6
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
|
.tfstate(client: Aws::EC2::Client.new) ⇒ Object
10
11
12
|
# File 'lib/terraforming/resource/route_table.rb', line 10
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
|
Instance Method Details
#tf ⇒ Object
18
19
20
|
# File 'lib/terraforming/resource/route_table.rb', line 18
def tf
apply_template(@client, "tf/route_table")
end
|
#tfstate ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/terraforming/resource/route_table.rb', line 22
def tfstate
route_tables.inject({}) do |resources, route_table|
attributes = {
"id" => route_table.route_table_id,
"vpc_id" => route_table.vpc_id,
}
attributes.merge!(tags_attributes_of(route_table))
attributes.merge!(routes_attributes_of(route_table))
attributes.merge!(propagating_vgws_attributes_of(route_table))
resources["aws_route_table.#{module_name_of(route_table)}"] = {
"type" => "aws_route_table",
"primary" => {
"id" => route_table.route_table_id,
"attributes" => attributes
}
}
resources
end
end
|