Skip to content

Terraform with S3 backend sporadically fails with "Error: RequestError: send request failed caused by: Post "https://sts.amazonaws.com/": net/http: TLS handshake timeout" #28714

Closed
@Cajga

Description

@Cajga

Terraform Version

$ terraform version
Terraform v0.15.3
on linux_amd64

Terraform Configuration Files

As the issue is happening even at a terraform init here is how the remote backend is configured:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "=3.39.0"
    }
  }
  required_version = "= 0.15.3"
  backend "s3" {
    bucket = "remote-state-IDGOESHERE"
    key    = "tf-state/terraform.tfstate"
    region = "eu-central-1"

    dynamodb_table = "remote-state-lock-IDGOESHERE"
    encrypt        = true
  }
}

Debug Output

We are running in a CI environment which is configured to run terraform in different directories (sometimes at the same time but inside a container so they do not conflict). At every CI job, we do a terrafom init and a terraform plan or apply. The issues happen with all kind of calls sporadically (~ 1 per every 30 terraform call).
Here you can see two trace outputs from two different runs:

Expected Behavior

Terraform calls work as expected

Actual Behavior

Terraform calls (init/plan and in few occasion apply) fail

Steps to Reproduce

As mentioned the issue happens with all type of terraform calls randomly

Additional Context

As mentioned above, terraform runs in a CI env configuring multiple directories. The issue happens sporadically and with different type of calls.

References

I could find some very old tickets searching for the phrase "net/http: TLS handshake timeout" which were closed with unable to reproduce but I am not sure if they were relevant (some of them had the issue permanently).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions