class GeoEngineer::Resources::AwsNatGateway
AwsNatGateway
is the aws_nat_gateway
terrform resource,
{www.terraform.io/docs/providers/aws/r/nat_gateway.html Terraform Docs}
Public Class Methods
_fetch_remote_resources(provider)
click to toggle source
# File lib/geoengineer/resources/aws_nat_gateway.rb, line 16 def self._fetch_remote_resources(provider) AwsClients.ec2(provider).describe_nat_gateways['nat_gateways'].map(&:to_h).map do |gateway| # AWS SDK has `nat_gateway_addresses` as an array, but you should only be able to # have exactly 1 elastic IP association. This logic should cover the bases... allocation = gateway[:nat_gateway_addresses].find { |addr| addr.key?(:allocation_id) } gateway[:_terraform_id] = gateway[:nat_gateway_id] gateway[:_geo_id] = "#{allocation[:allocation_id]}::#{gateway[:subnet_id]}" gateway end end