Class: Terraforming::Resource::InternetGateway
- Inherits:
-
Object
- Object
- Terraforming::Resource::InternetGateway
show all
- Includes:
- Util
- Defined in:
- lib/terraforming/resource/internet_gateway.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
Returns a new instance of InternetGateway.
14
15
16
|
# File 'lib/terraforming/resource/internet_gateway.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/internet_gateway.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/internet_gateway.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/internet_gateway.rb', line 18
def tf
apply_template(@client, "tf/internet_gateway")
end
|
#tfstate ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/terraforming/resource/internet_gateway.rb', line 22
def tfstate
internet_gateways.inject({}) do |resources, internet_gateway|
next resources if internet_gateway.attachments.empty?
attributes = {
"id" => internet_gateway.internet_gateway_id,
"vpc_id" => internet_gateway.attachments[0].vpc_id,
"tags.#" => internet_gateway.tags.length.to_s,
}
resources["aws_internet_gateway.#{module_name_of(internet_gateway)}"] = {
"type" => "aws_internet_gateway",
"primary" => {
"id" => internet_gateway.internet_gateway_id,
"attributes" => attributes
}
}
resources
end
end
|