How can I use modified provider at terraform?

Hello. Now I am trying to debug terraform opensource…
I want to confirm terraform-provider-aws but this file is complile at linux_amd64 folder as binary, so I couldn’t debug it.

So, I downloaded terraform-provider-aws open source, and changed some code.
After that I changed it to plugin file using

go build -buildmode=plugin -o terraform-provider-aws_v4.33.0_x5

this commend.

And in ‘terraform’, I confirmed .terraform.lock.hcl file and understood that it uses aws provider version 4.33.0.

I checked my terraform-provider-aws’s version is 4.33.0

But it gives error message like this

│ Error: Required plugins are not installed
│ 
│ The installed provider plugins are not consistent with the packages selected in the dependency lock file:
│   - registry.terraform.io/hashicorp/aws: the cached package for registry.terraform.io/hashicorp/aws 4.33.0 (in .terraform/providers) does not match any of the checksums recorded in the dependency lock file
│ 
│ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this configuration, run:
│   terraform init

could you please tell me how to solve this problem??

I used -lock and terraform force-unlock <lockID> commend, but result didn’t changed

Or, how can I debug terraform-provider-aws by using terraform ??
Thank you!!

Hi @chan.ryoo,

You can get a lot more detailed information about provider discovery from the page: Plugin Development - How Terraform Works With Plugins | Terraform | HashiCorp Developer, and more specifically CLI Configuration: Provider Installation (I usually use the dev_overrides method, just note that this bypasses the init discovery mechanism, so it’s OK for init to fail even if setup correctly)

You also want to remove -buildmode=plugin, which is not used for this purpose.