hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Explore replacement of mitchellh packages #16939

Open SarahFrench opened 8 months ago

SarahFrench commented 8 months ago

Background

Mitchell Hashimoto / mitchellh announced that he's archiving multiple packages, including ones that are used in the Google providers:

Projects using these dependencies will continue to work, but if any updates are required then we'll need to migrate to using a fork.

To repeat: Existing dependent projects will continue to work. I only plan on archiving the projects below, I'm not deleting them. So existing projects that depend on these repositories will continue to function as before. And like I said, given I've poorly maintained them for a couple years already, there is already little practical difference in this decision (i.e. I've closed few if any issues/PRs), I'm just trying to be more transparent and intentional moving forward.

What kind of contribution is this issue about?

Related PR(s), if any:

Details

There currently don't appear to be any official/endorsed forks for mitchellh/go-homedir or mitchellh/hashstructure

roaks3 commented 4 months ago

homedir was added with https://github.com/GoogleCloudPlatform/magic-modules/pull/3971, following the guidance for upgrading to sdkv2. Copying the code for PathOrContents() brought in the explicit dependency on homedir, which is used to allow ~ to be included in the access token path or credentials path provided by the user.

The implementation of homedir is primarily supporting multiple environments, which we would need to preserve. We might be able to do without the caching, in our particular case. Without a blessed alternative, it seems like the best option for this one would be to copy the Go source and test (2 files) directly into our repo. It is under MIT license: https://github.com/mitchellh/go-homedir.

roaks3 commented 4 months ago

hashstructure is used in resourceComputeInstanceUpdate() to hash the full compute disk object, for the purpose of quickly comparing disks (old val vs new val). We would need to preserve that behavior, but it doesn't necessarily need to be through the same hash function (or any hash function). hashstructure also includes a lot of options and generalized behavior we don't need.

Recommendation would be to write a simpler hash function for compute disks (for example, a hash of the string representation). We could fall back to copying the hashstructure implementation, but there would be a slightly larger maintenance burden. It uses MIT license: https://github.com/mitchellh/hashstructure.