rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
253 stars 216 forks source link

Use unzip instead of gunzip in `setup-provider.sh` #1364

Closed HarrisonWAffel closed 3 days ago

HarrisonWAffel commented 3 days ago

Problem

When testing setup-provider.sh I was unable to properly download both 4.0.0-rc5 or 4.2.0-rc3, as gunzip reported an unknown compression format. This resulted in an empty file in the directory which should include the provider binary. This script references gzip, but does not use it when uncompressing the provider zip file. After switching the command, I also encountered issues with gzip. While the command executed without error, the downloaded file was not properly decompressed and thus was not useable.

In both scenarios running terraform plan on a file using the downloaded provider resulted in

provider "terraform.local/local/rancher2" to obtain schema: fork/exec .terraform/providers/terraform.local/local/rancher2/4.2.0-rc3/darwin_arm64/terraform-provider-rancher2: exec
│ format error..

Solution

Remove gunzip and gzip in favor of only using unzip. unzip is specifically built for zip files, and is installed by default on mac. For linux, it can be installed via apt. This change also removes a brew command invocation which would fail on linux systems.

Testing

Run this script against the latest rancher2 version (4.2.0-rc3) as well as the latest rke version (v1.5.0) and ensure that a simple terraform file can be planned / applied as expected. Run the file command against the downloaded provider binary, and ensure it is a valid executable for your system and is not compressed.

Engineering Testing

Manual Testing

I've done the above

Automated Testing

QA Testing Considerations

Regressions Considerations

n/a