cloudflare / cf-terraforming

A command line utility to facilitate terraforming your existing Cloudflare resources.
Mozilla Public License 2.0
989 stars 139 forks source link

CLOUDFLARE_PROVIDER_REGISTRY_HOSTNAME as env value is ignored #726

Closed mgergye closed 4 months ago

mgergye commented 4 months ago

Confirmation

cf-terraforming version

v0.20.0

Expected outcome

CLOUDFLARE_PROVIDER_REGISTRY_HOSTNAME overrides the default terraform registry

Actual outcome

CLOUDFLARE_PROVIDER_REGISTRY_HOSTNAME is ignored, only --provider-registry-hostname is respected

Steps to reproduce

First of all thank you for providing tofu compatibility, but it seems that the PR https://github.com/cloudflare/cf-terraforming/pull/630 might be not complete.

Recently we migrated from terraform to tofu and wanted to verify our integrity, but - despite exporting both CLOUDFLARE_TERRAFORM_BINARY_PATH and CLOUDFLARE_PROVIDER_REGISTRY_HOSTNAME as env variables as the readme instructs - we constantly run into the following error:

FATA[0000] failed to detect provider installation       

The tracker only contains one similar issue in regards of this problem (using it with tofu), and that issue actually ended up adding the compatibility (again, many thanks). Out of pure curiosity we switched from env vars to flags and voila, everything worked.

References

No response

jacobbednarz commented 4 months ago

unsure whether this behaviour changed in viper recently however, i've explicitly updated it to fetch from GetString now which will get the right value from the environment variable as well as the flag.