{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/4105","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/4105/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4105/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/4105/events","html_url":"https://github.com/hashicorp/terraform/issues/4105","id":119419070,"number":4105,"title":"AWS route table and nat instance route modification","user":{"login":"igoratencompass","id":3914396,"avatar_url":"https://avatars.githubusercontent.com/u/3914396?v=3","gravatar_id":"","url":"https://api.github.com/users/igoratencompass","html_url":"https://github.com/igoratencompass","followers_url":"https://api.github.com/users/igoratencompass/followers","following_url":"https://api.github.com/users/igoratencompass/following{/other_user}","gists_url":"https://api.github.com/users/igoratencompass/gists{/gist_id}","starred_url":"https://api.github.com/users/igoratencompass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoratencompass/subscriptions","organizations_url":"https://api.github.com/users/igoratencompass/orgs","repos_url":"https://api.github.com/users/igoratencompass/repos","events_url":"https://api.github.com/users/igoratencompass/events{/privacy}","received_events_url":"https://api.github.com/users/igoratencompass/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/aws","name":"provider/aws","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-30T05:01:43Z","updated_at":"2015-12-07T23:43:00Z","closed_at":null,"body":"Hi all,\r\n\r\nI have a private route table resource in ec2 being created as:\r\n\r\nresource \"aws_route_table\" \"private-subnet\" {\r\n    vpc_id = \"${aws_vpc.environment.id}\"{\r\n        Name        = \"${var.vpc.tag}-private-subnet-route-table\"\r\n        Environment = \"${var.vpc.tag}\"\r\n    }\r\n}\r\n\r\nresource \"aws_route_table_association\" \"private-subnet\" {\r\n    count          = \"${var.vpc.az_count}\"\r\n    subnet_id      = \"${element(aws_subnet.private-subnets.*.id, count.index)}\"\r\n    route_table_id = \"${aws_route_table.private-subnet.id}\"\r\n}\r\n\r\nThen later in the same play, a nat instance gets launched that modifies the route table adding it's self as default gateway via user-data script. Now when ever I run the plan again after adding new resource lets say, TF modifies the route table removing the nat instance record.\r\n\r\nSince TF is aware of the changes made by user-data of another resource, reverting the changes is a wrong thing to do.\r\n\r\nI have asked about this in TF google group but never got any response back explaining why is this happening, please see https://groups.google.com/forum/#!topic/terraform-tool/MxEXo9hhqHk\r\n\r\nThanks,\r\nIgor "},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/162706797","html_url":"https://github.com/hashicorp/terraform/issues/4105#issuecomment-162706797","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4105","id":162706797,"user":{"login":"igoratencompass","id":3914396,"avatar_url":"https://avatars.githubusercontent.com/u/3914396?v=3","gravatar_id":"","url":"https://api.github.com/users/igoratencompass","html_url":"https://github.com/igoratencompass","followers_url":"https://api.github.com/users/igoratencompass/followers","following_url":"https://api.github.com/users/igoratencompass/following{/other_user}","gists_url":"https://api.github.com/users/igoratencompass/gists{/gist_id}","starred_url":"https://api.github.com/users/igoratencompass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igoratencompass/subscriptions","organizations_url":"https://api.github.com/users/igoratencompass/orgs","repos_url":"https://api.github.com/users/igoratencompass/repos","events_url":"https://api.github.com/users/igoratencompass/events{/privacy}","received_events_url":"https://api.github.com/users/igoratencompass/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T23:43:00Z","updated_at":"2015-12-07T23:43:00Z","body":"Just as an example, the initial plan run:\r\n\r\n+ aws_route_table.private-subnet\r\n    tags.#:           \"\" => \"2\"\r\n    tags.Environment: \"\" => \"ENV\"\r\n    tags.Name:        \"\" => \"ENV-private-subnet-route-table\"\r\n    vpc_id:           \"\" => \"${aws_vpc.environment.id}\"\r\n\r\nThe run:\r\n\r\naws_route_table.private-subnet: Creating...\r\n  tags.#:           \"\" => \"2\"\r\n  tags.Environment: \"\" => \"ENV\"\r\n  tags.Name:        \"\" => \"ENV-private-subnet-route-table\"\r\n  vpc_id:           \"\" => \"vpc-48a4f42d\"\r\n\r\nWhen finished I make a small change to a security group of some random resource and re-run the plan:\r\n\r\n~ aws_route_table.private-subnet\r\n    route.#:                                    \"1\" => \"0\"\r\n    route.2890251652.cidr_block:                \"0.0.0.0/0\" => \"\"\r\n    route.2890251652.gateway_id:                \"\" => \"\"\r\n    route.2890251652.instance_id:               \"i-bd274d36\" => \"\"\r\n    route.2890251652.network_interface_id:      \"eni-a5eb7bed\" => \"\"\r\n    route.2890251652.vpc_peering_connection_id: \"\" => \"\"\r\n\r\nObviously it is very much aware of the change and even gives me the details of the NAT instance, its id and the network interface. "}}