<commit_before>require_relative '../resource'

module Convection
  module Model
    class Template
      class Resource
        ##
        # AWS::EC2::Route
        ##
        class EC2Route < Resource
          type 'AWS::EC2::Route'
          property :route_table_id, 'RouteTableId'
          property :destination, 'DestinationCidrBlock'
          property :gateway, 'GatewayId'
          property :nat_gateway, 'NatGatewayId'
          property :instance, 'InstanceId'
          property :interface, 'NetworkInterfaceId'
          property :peer, 'VpcPeeringConnectionId'
        end
      end
    end
  end
end<commit_msg>Export AWS::EC2::Route objects as Terraform Route resources.<commit_after>require_relative '../resource'

module Convection
  module Model
    class Template
      class Resource
        ##
        # AWS::EC2::Route
        ##
        class EC2Route < Resource
          type 'AWS::EC2::Route'
          property :route_table_id, 'RouteTableId'
          property :destination, 'DestinationCidrBlock'
          property :gateway, 'GatewayId'
          property :nat_gateway, 'NatGatewayId'
          property :instance, 'InstanceId'
          property :interface, 'NetworkInterfaceId'
          property :peer, 'VpcPeeringConnectionId'

          def to_hcl_json(*)
            tf_record_attrs = {
              route_table_id: route_table_id,
              destination_cidr_block: destination,
              vpc_peering_connection_id: peer,
              gateway_id: gateway,
              nat_gateway_id: nat_gateway,
              instance_id: instance,
              network_interface_id: interface
            }

            tf_record_attrs.reject! { |_, v| v.nil? }

            tf_record = {
              aws_route: {
                name.underscore => tf_record_attrs
              }
            }

            { resource: tf_record }.to_json
          end

          def terraform_import_commands(module_path: 'root')
            ['# Route import is not supported by Terraform.']
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07774022211492033, 'fraction_numerical': 0.003380009657170449, 'mean_word_length': 1.8658367911479945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5996803', 'n_tokens_mistral': 567, 'n_tokens_neox': 564, 'n_words': 128}