Cannot run terraform providers lock or terraform init because hashicorp/template is deprecated

When I try to do a terraform init. (terraform version 1.0.0) I get

│ Error: Failed to install provider
│
│ Error while installing hashicorp/template v2.2.0: the current package for
│ registry.terraform.io/hashicorp/template 2.2.0 doesn't match any of the
│ checksums previously recorded in the dependency lock file

When I run terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/template]
└── provider[registry.terraform.io/hashicorp/aws]

Providers required by state:

    provider[registry.terraform.io/hashicorp/aws]

    provider[registry.terraform.io/hashicorp/template]

When I try to run terraform providers lock -platform=linux_amd64 -platform=darwin_amd64

- Fetching hashicorp/template 2.2.0 for darwin_amd64...
╷
│ Error: Could not retrieve providers for locking
│
│ Terraform failed to fetch the requested providers for darwin_amd64 in order
│ to calculate their checksums: some providers could not be installed:
│ - registry.terraform.io/hashicorp/template: the current package for
│ registry.terraform.io/hashicorp/template 2.2.0 doesn't match any of the
│ checksums previously recorded in the dependency lock file.

Apparently, the checksum in the .terraform.lock.hcl file was wrong. I removed it and reran the terraform providers lock and then ran terraform init and it worked.