<commit_before>package aws

import (
	"fmt"
	"log"
	"reflect"

	"github.com/hashicorp/terraform/flatmap"
	"github.com/hashicorp/terraform/helper/diff"
	"github.com/hashicorp/terraform/terraform"
	"github.com/mitchellh/goamz/ec2"
)

func resource_aws_route_table_create(
	s *terraform.ResourceState,
	d *terraform.ResourceDiff,
	meta interface{}) (*terraform.ResourceState, error) {
	p := meta.(*ResourceProvider)
	ec2conn := p.ec2conn

	// Merge the diff so that we have all the proper attributes
	s = s.MergeDiff(d)

	// Create the routing table
	createOpts := &ec2.CreateRouteTable{
		VpcId: s.Attributes["vpc_id"],
	}
	log.Printf("[DEBUG] RouteTable create config: %#v", createOpts)
	resp, err := ec2conn.CreateRouteTable(createOpts)
	if err != nil {
		return nil, fmt.Errorf("Error creating route table: %s", err)
	}

	// Get the ID and store it
	rt := &resp.RouteTable
	s.ID = rt.RouteTableId
	log.Printf("[INFO] Route Table ID: %s", s.ID)

	// Update our routes
	return resource_aws_route_table_update(s, d, meta)
}

func resource_aws_route_table_update(
	s *terraform.ResourceState,
	d *terraform.ResourceDiff,
	meta interface{}) (*terraform.ResourceState, error) {
	p := meta.(*ResourceProvider)
	ec2conn := p.ec2conn

	// Our resulting state
	rs := s.MergeDiff(d)

	// Get our routes out of the merge
	oldroutes := flatmap.Expand(s.Attributes, "route")
	routes := flatmap.Expand(s.MergeDiff(d).Attributes, "route")
<commit_msg>providers/aws: don't merge diff early<commit_after>package aws

import (
	"fmt"
	"log"
	"reflect"

	"github.com/hashicorp/terraform/flatmap"
	"github.com/hashicorp/terraform/helper/diff"
	"github.com/hashicorp/terraform/terraform"
	"github.com/mitchellh/goamz/ec2"
)

func resource_aws_route_table_create(
	s *terraform.ResourceState,
	d *terraform.ResourceDiff,
	meta interface{}) (*terraform.ResourceState, error) {
	p := meta.(*ResourceProvider)
	ec2conn := p.ec2conn

	// Create the routing table
	createOpts := &ec2.CreateRouteTable{
		VpcId: d.Attributes["vpc_id"].New,
	}
	log.Printf("[DEBUG] RouteTable create config: %#v", createOpts)
	resp, err := ec2conn.CreateRouteTable(createOpts)
	if err != nil {
		return nil, fmt.Errorf("Error creating route table: %s", err)
	}

	// Get the ID and store it
	rt := &resp.RouteTable
	s.ID = rt.RouteTableId
	log.Printf("[INFO] Route Table ID: %s", s.ID)

	// Update our routes
	return resource_aws_route_table_update(s, d, meta)
}

func resource_aws_route_table_update(
	s *terraform.ResourceState,
	d *terraform.ResourceDiff,
	meta interface{}) (*terraform.ResourceState, error) {
	p := meta.(*ResourceProvider)
	ec2conn := p.ec2conn

	// Our resulting state
	rs := s.MergeDiff(d)

	// Get our routes out of the merge
	oldroutes := flatmap.Expand(s.Attributes, "route")
	routes := flatmap.Expand(s.MergeDiff(d).Attributes, "route")

{'fraction_non_alphanumeric': 0.1369765791341377, 'fraction_numerical': 0.0049680624556423, 'mean_word_length': 4.706477732793522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3625021', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1045, 'n_words': 231}