terraform-provider-aws: aws_route timeouts do not seem to be respected

Timeouts for aws_route resources do not seem to be respected. In my use case, routes are provisioned by looping over a list of ~20 destinations. From time to time, the routes creation times out after 2 minutes while waiting for state to become ready. Note that timeouts for creation and deletion are set to 10 minutes.

Terraform Version:

Terraform v0.15.4 
on linux_amd64

Provider Version: hashicorp/aws v3.48.0 (signed by HashiCorp)

HCL:

 resource "aws_route" "route-az1" {
   for_each = toset(local.tgw_routes)
   route_table_id            =  var.route_table_id
   destination_cidr_block    =  each.key
   transit_gateway_id = var.tgw_id
   timeouts {
     create = "10m"
     delete = "10m"
   }
   depends_on = [
     aws_ec2_transit_gateway_vpc_attachment.tgw_vpc_attachment
   ]
}

Error:

module.tgw-attachment.aws_route.route-az1["151.109.0.0/16"]: Still creating... [1m50s elapsed] 
module.tgw-attachment.aws_route.route-az1["151.109.0.0/16"]: Still creating... [2m0s elapsed] 

Error: error waiting for Route in Route Table (rtb-0026655720eae379d) with destination (151.109.0.0/16) to become available: timeout while waiting for state to become 'ready' (timeout: 2m0s) 
on ../30049-aws-terraform-transit-gateway-attachment-module/main.tf line 94, in resource "aws_route" "route-az1": 
94: resource "aws_route" "route-az1" { 

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 16 (3 by maintainers)

Most upvoted comments

@bill-rich Would it make sense to classify this issue as a bug rather than an “enhancement”? Note that the feature is documented here: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route#timeouts but is not working.

I hit this today on us-east-1 with aws provider 3.50.0 and terraform 0.14.7. A 5m create timeout was set, but the error was (timeout2m) Error: error waiting for Route in Route Table (rtb-xxx) with destination (0.0.0.0/0) to become available: timeout while waiting for state to become 'ready' (timeout: 2m0s)

@bill-rich this seems like it is a bug to me? any update on this?

Judging by lines 50-53 of resource_aws_route.go the ability to adjust timeouts hasn’t been implemented.

		Timeouts: &schema.ResourceTimeout{
			Create: schema.DefaultTimeout(2 * time.Minute),
			Delete: schema.DefaultTimeout(5 * time.Minute),
		},

Hi! We are also having this issue in our automation. Any response will be much appreciated. 🙏

We’re running into this bug as well. Our time-out is set for 5 minutes but it stops processing at the 2 minute mark. This failure leaves the state-file in a corrupted/partial state which we have to manually fix. This issue is breaking our automation.

Judging by lines 50-53 of resource_aws_route.go the ability to adjust timeouts hasn’t been implemented.

		Timeouts: &schema.ResourceTimeout{
			Create: schema.DefaultTimeout(2 * time.Minute),
			Delete: schema.DefaultTimeout(5 * time.Minute),
		},

I believed this was refactored in https://github.com/hashicorp/terraform-provider-aws/pull/17319 with v3.35.0. I hope my fix will fix the issue