class Terraforming::Resource::VPNGateway
Public Class Methods
new(client)
click to toggle source
# File lib/terraforming/resource/vpn_gateway.rb, line 14 def initialize(client) @client = client end
tf(client: Aws::EC2::Client.new)
click to toggle source
# File lib/terraforming/resource/vpn_gateway.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/vpn_gateway.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/vpn_gateway.rb, line 18 def tf apply_template(@client, "tf/vpn_gateway") end
tfstate()
click to toggle source
# File lib/terraforming/resource/vpn_gateway.rb, line 22 def tfstate vpn_gateways.inject({}) do |resources, vpn_gateway| next resources if vpn_gateway.vpc_attachments.empty? attributes = { "id" => vpn_gateway.vpn_gateway_id, "vpc_id" => vpn_gateway.vpc_attachments[0].vpc_id, "availability_zone" => vpn_gateway.availability_zone, "tags.#" => vpn_gateway.tags.length.to_s, } resources["aws_vpn_gateway.#{module_name_of(vpn_gateway)}"] = { "type" => "aws_vpn_gateway", "primary" => { "id" => vpn_gateway.vpn_gateway_id, "attributes" => attributes } } resources end end
Private Instance Methods
module_name_of(vpn_gateway)
click to toggle source
# File lib/terraforming/resource/vpn_gateway.rb, line 50 def module_name_of(vpn_gateway) normalize_module_name(name_from_tag(vpn_gateway, vpn_gateway.vpn_gateway_id)) end
vpn_gateways()
click to toggle source
# File lib/terraforming/resource/vpn_gateway.rb, line 46 def vpn_gateways @client.describe_vpn_gateways.map(&:vpn_gateways).flatten end