Getting the following on Windows 11 - Error while installing hashicorp/aws v5.25.0: local error: tls: bad record MAC

I am new to terraform and I had installed terraform on windows 11.
I had created a .tf file with the following contents
provider “aws” {
region = “us-east-2”
access_key = “valid_key”
secret_key = “valid_secret”
}

resource “aws_instance” “example” {
ami = ami-089c26792dcb1fbd4
instance_type = “t2.micro”
subnet_id = aws_subnet.example.id

cpu_options {
core_count = 2
threads_per_core = 2
}

tags = {
Name = “tf-example”
}
}

When I fire the command - teraform>terraform init
It is giving the following error

Initializing the backend…

Initializing provider plugins…

  • Finding latest version of hashicorp/aws…
  • Installing hashicorp/aws v5.25.0…

    │ Error: Failed to install provider

    │ Error while installing hashicorp/aws v5.25.0: local error: tls: bad record MAC

I was able to init an example config using 5.25.0 on Windows 10 (don’t have immediate access to a Windows 11 box). Do other providers produce the same error, or is it only this one?

I don’t know if your issue is resolved or not. I recently started working on Terraform and faced the similar issue.

It got fixed after I changed my network configuration. I switched my wifi and it got fixed.

“bad record MAC” suggests that a TLS (i.e. HTTPS) message Terraform recieved was invalid.

It’s possible in principle that the CDN for registry.terraform.io would implement TLS incorrectly, but that seems unlikely because it would affect a larger number of people.

Therefore it seems more likely that something closer to your computer is somehow corrupting the TLS stream. The fact that switching to a different network (or reconfiguring your connection to the same network) cleared the error seems to support the assumption that something is going wrong on your own network.

Unfortunately I can’t suggest anything specific that would solve that in all cases.

This topic was automatically closed after 12 days. New replies are no longer allowed.