Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_default_route_table resource crash with routes to VPC endpoints #10295

Closed
ewbankkit opened this issue Nov 22, 2016 · 3 comments · Fixed by #10303
Closed

aws_default_route_table resource crash with routes to VPC endpoints #10295

ewbankkit opened this issue Nov 22, 2016 · 3 comments · Fixed by #10303

Comments

@ewbankkit
Copy link
Contributor

Managing an aws_default_route_table resource crashes during terraform apply if the route table contains routes to VPC endpoints.
Terraform version: 0.7.11.
Sample HCL:

provider "aws" {
    region = "us-west-2"
}

resource "aws_vpc" "test" {
    cidr_block = "10.0.0.0/16"

    tags {
        Name = "test"
    }
}

resource "aws_internet_gateway" "igw" {
    vpc_id = "${aws_vpc.test.id}"

    tags {
        Name = "test"
    }
}

resource "aws_vpc_endpoint" "s3" {
    vpc_id = "${aws_vpc.test.id}"
    service_name = "com.amazonaws.us-west-2.s3"
    route_table_ids = [
        "${aws_vpc.test.default_route_table_id}"
    ]
}

resource "aws_default_route_table" "default" {
    default_route_table_id = "${aws_vpc.test.default_route_table_id}"

    tags {
        Name = "test"
    }

    route {
        cidr_block = "0.0.0.0/0"
        gateway_id = "${aws_internet_gateway.igw.id}"
    }
}
$ terraform apply
aws_vpc.test: Creating...
  cidr_block:                "" => "10.0.0.0/16"
  default_network_acl_id:    "" => "<computed>"
  default_route_table_id:    "" => "<computed>"
  default_security_group_id: "" => "<computed>"
  dhcp_options_id:           "" => "<computed>"
  enable_classiclink:        "" => "<computed>"
  enable_dns_hostnames:      "" => "<computed>"
  enable_dns_support:        "" => "<computed>"
  instance_tenancy:          "" => "<computed>"
  main_route_table_id:       "" => "<computed>"
  tags.%:                    "" => "1"
  tags.Name:                 "" => "test"
aws_vpc.test: Creation complete
aws_internet_gateway.igw: Creating...
  tags.%:    "0" => "1"
  tags.Name: "" => "test"
  vpc_id:    "" => "vpc-0b65a66c"
aws_vpc_endpoint.s3: Creating...
  policy:                     "" => "<computed>"
  prefix_list_id:             "" => "<computed>"
  route_table_ids.#:          "" => "1"
  route_table_ids.1168383243: "" => "rtb-401e8a27"
  service_name:               "" => "com.amazonaws.us-west-2.s3"
  vpc_id:                     "" => "vpc-0b65a66c"
aws_vpc_endpoint.s3: Creation complete
aws_internet_gateway.igw: Creation complete
aws_default_route_table.default: Creating...
  default_route_table_id:                    "" => "rtb-401e8a27"
  route.#:                                   "" => "1"
  route.621611207.cidr_block:                "" => "0.0.0.0/0"
  route.621611207.gateway_id:                "" => "igw-fdaa3499"
  route.621611207.instance_id:               "" => ""
  route.621611207.nat_gateway_id:            "" => ""
  route.621611207.network_interface_id:      "" => ""
  route.621611207.vpc_peering_connection_id: "" => ""
  tags.%:                                    "" => "1"
  tags.Name:                                 "" => "test"
  vpc_id:                                    "" => "<computed>"
Error applying plan:

1 error(s) occurred:

* aws_default_route_table.default: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
panic: runtime error: invalid memory address or nil pointer dereference
2016/11/22 12:07:52 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3e0264]
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 
2016/11/22 12:07:52 [DEBUG] plugin: terraform: goroutine 298 [running]:
2016/11/22 12:07:52 [DEBUG] plugin: terraform: panic(0x261a740, 0xc42000e0b0)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/go/src/runtime/panic.go:500 +0x1a1
2016/11/22 12:07:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/aws.revokeAllRouteTableRules(0xc4200eee20, 0xc, 0x23674a0, 0xc420500340, 0x1, 0x0)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_default_route_table.go:193 +0x504
2016/11/22 12:07:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsDefaultRouteTableCreate(0xc420540f00, 0x23674a0, 0xc420500340, 0xc4203ad740, 0x15fd1)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_default_route_table.go:104 +0x287
2016/11/22 12:07:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc42081fda0, 0xc4206409b0, 0xc420147cc0, 0x23674a0, 0xc420500340, 0x1, 0xc4201c5800, 0x18)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:162 +0x30e
2016/11/22 12:07:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc4206971d0, 0xc420640910, 0xc4206409b0, 0xc420147cc0, 0x0, 0xa83ae7, 0xc42010e380)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:178 +0x9b
2016/11/22 12:07:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4202947a0, 0xc420147c00, 0xc4200eeee0, 0x0, 0x0)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/plugin/resource_provider.go:460 +0x57
2016/11/22 12:07:52 [DEBUG] plugin: terraform: reflect.Value.call(0xc4204920c0, 0xc42002e8f0, 0x13, 0x2bff6b2, 0x4, 0xc4208d3ed0, 0x3, 0x3, 0xc42000dc00, 0xc420540cc0, ...)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/go/src/reflect/value.go:434 +0x5c8
2016/11/22 12:07:52 [DEBUG] plugin: terraform: reflect.Value.Call(0xc4204920c0, 0xc42002e8f0, 0x13, 0xc4208d3ed0, 0x3, 0x3, 0xb6092f, 0xc4203886f0, 0xc420388700)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/go/src/reflect/value.go:302 +0xa4
2016/11/22 12:07:52 [DEBUG] plugin: terraform: net/rpc.(*service).call(0xc420306c40, 0xc420306c00, 0xc42028d468, 0xc420088e80, 0xc42069b480, 0x23693a0, 0xc420147c00, 0x16, 0x23693e0, 0xc4200eeee0, ...)
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/go/src/net/rpc/server.go:383 +0x148
2016/11/22 12:07:52 [DEBUG] plugin: terraform: created by net/rpc.(*Server).ServeCodec
2016/11/22 12:07:52 [DEBUG] plugin: terraform: 	/opt/go/src/net/rpc/server.go:477 +0x421
@ewbankkit
Copy link
Contributor Author

@ewbankkit
Copy link
Contributor Author

This crash can have the effect of removing routes from the default route table which then have to be added back manually.

@ghost
Copy link

ghost commented Apr 19, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants