aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

[BUG] Error while installing hashicorp/azurerm v3.77.0: local error: tls: bad record MAC

Open Racle opened this issue 2 years ago • 4 comments

New to this tool.

After running "Initializing" for little while, it throws error: (4 times same error)

initializing provider for the import directories: 4 errors occurred:
        * task error: error running terraform init: exit status 1

  Error: Failed to install provider

  Error while installing hashicorp/azurerm v3.77.0: local error: tls: bad record MAC

I'm trying to export resource group with aztfexport resource-group my-rg-group-name. I'm already logged in with az login. It creates provider.tf .terraform .terraform.lock.hcl terraform.tf files to current folder.

If I run these commands terraform seems to be working just fine

> rm .terraform* -rf
> terraform init

Initializing the backend...

Successfully configured the backend "local"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Finding hashicorp/azurerm versions matching "3.77.0"...
- Installing hashicorp/azurerm v3.77.0...
- Installed hashicorp/azurerm v3.77.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

Is there some step I'm missing with this tool, or is this just broken for now?

Pop!_OS 22.04 LTS

Terraform v1.7.4

"azure-cli": "2.58.0",
"azure-cli-core": "2.58.0",
"azure-cli-telemetry": "1.1.0"

aztfexport version dev // installed with go get

Racle avatar Mar 13 '24 13:03 Racle

Quick update.

Relogged with az login (even while everything seemed to work) Ran aztfexport resource-group --provider-name=azapi my-rg-group-name Now it seems to be importing data with azapi. seems like that default provider failed for some reason.

Racle avatar Mar 13 '24 13:03 Racle

@Racle bad record MAC is a very internal error, which usually means network corruption of some sorts (like a proxy changing the contents of the TCP stream), or a severe issue in the TLS stack.\

So would you please double check your network setup, or try to target to a different provider version of azurerm via --provider-version?

magodo avatar Mar 14 '24 03:03 magodo

@magodo tried using version 3.95.0, 3.0.0 and 2.99.0, all have same problem.

And like I said earlier, after removing terraform hidden files and running terraform init, it works as intented and it downloads provider correctly without any errors (but doesn't export resource group of course), so I'm wondering why that can download and install provider correctly while this tool seems to fail the same thing.

Racle avatar Mar 14 '24 05:03 Racle

@Racle That is weired... As the tool actually is doing nothing special up to the init part:

  • Construct the terraform.tf and provider.tf it not available
  • Running terraform init via https://github.com/hashicorp/terraform-exec

One thing you can do is to use the --dev-provider option, which will skip the terraform init, but it requires you have manually initialize the provider, or setup the dev provider settings beforehead.

magodo avatar Mar 15 '24 03:03 magodo

:wave:

Since we've not heard back here I'm going to close this issue for the moment. Feel free to reopen if still have questions.

magodo avatar Aug 09 '24 07:08 magodo