'How to verify Terraform provider h1 locally

I've patched and released an internal fork of F5 Bigip based on BigIP one, which is released on internal network mirror. Important note: I build the provider on Windows, I have no choice to build this on a Linux platform. I build provider for both Windows and Linux on this machine

I face two issues:

Linux Provider binary is not executable

Description

Linux provider zip package contains provider file which is not executable

Bypass

  1. Run chmox +x .terraform/providers/f5networks/bigip/terraform-provider-XXXXX in project root
  2. Run terraform init -upgrade
  3. Run terraform plan
  4. Works

Question

How to make this provider executable after build time ?

Compute h1 checksum

Description

To deploy this on our static mirror, we need to compute a h1 of the provider. Terraform uses this lib to compute h1: https://pkg.go.dev/golang.org/x/mod/sumdb/dirhash

But, when I run the suggestion command: find . -type f | sort | sha256sum | base64 and then run terraform init -upgrade, Terraform says checkum do not match

Bypass

  1. Generate zh checksum (sha256sum over .zip), put id in 1.2.3.json
  2. Run terraform init -upgrade
  3. Grab h1 from .terraform.lock.hcl and copy it to 1.2.3.json and remove zh
  4. Run terraform init -upgrade
  5. Run terraform plan
  6. Works

Question

Which command should I run to get h1 from the command line to directly copy into json file ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source