mumoshu/terraform-provider-eksctl

Fish-food dep repo deprecated

Opened this issue · 6 comments

The fishworks/fish-food repo, on which this provider depends on to fetch eksctl versions has been deprecated.

Opening this to discuss possible workarounds.

Tangential, but another issue I've run into is cross-platform compat. eg: when using this module on M1 macs the TF binary would be ARM as well as the module, but calls fail immediately after calling the gofish binary, which is being fetched for x86.
This makes me think that a possible workaround could involve dropping the binary fetcher altogether and rely on eksctl directly?

Thanks for the issue, sorry for the delay in response.

100% agree here, I don't think the provider should be managing the installation of the eksctl tool. There are a couple of reasons I think this is a bad approach.

  • Tools like fishworks/fish-food require a lot of maintenance and as you can see the repo has been achieved for that reason
  • Separation of concerns, the provider shouldn't be concerned with managing binaries. This should be done as part of the bootstrapping of the machine that is running the terraform provider.

I'll work on a PR to remove this and update the readme appropriately on how to install eksctl.

I don't think the provider should be managing the installation of the eksctl tool

In general i would agree.
However, when using terraform cloud this becomes a challenge as you cannot just easy install custom cli tools before the provider is initialized.

@project0 typically you'd need the binaries available on the host environment - that's how providers such as kubernetes and helm work. You need to bring your own binary and that decouples a great part of the implementation - otherwise you're just chasing new features and incompatibility, which is the case with eksctl and this provider.
Wait for the binary to be available and supported, then the provider to be updated and then you can use it vs just update your host and use the latest binary with whatever compatible version of the provider.

@project0 typically you'd need the binaries available on the host environment

Yes, i understand this. But with terraform cloud you are fully dependent on hashicorp.

I built a little workaround with the help of the external provider, it seems to work :-)

locals {
  eksctl_version           = "0.122.0"
  eksctl_release_url       = "https://github.com/weaveworks/eksctl/releases/download/v${local.eksctl_version}/eksctl_Linux_amd64.tar.gz"
  eksctl_tmp_bin           = "/tmp/terraform-eksctl-bin-${local.eksctl_version}"
  eksctl_external_provider = <<EOH
echo '{"bin": "${local.eksctl_tmp_bin}"}';
if [ -x ${local.eksctl_tmp_bin} ]; then exit 0; fi;
curl -s -L "${local.eksctl_release_url}" -o ${local.eksctl_tmp_bin}.tar.gz &&
tar xf ${local.eksctl_tmp_bin}.tar.gz &&
rm -f ${local.eksctl_tmp_bin}.tar.gz &&
mv eksctl ${local.eksctl_tmp_bin}
EOH
}

data "external" "eksctl" {
  program = [
    "bash", "-e", "-c", local.eksctl_external_provider
  ]
  working_dir = "/tmp"
}

resource "eksctl_cluster" "management" {
  eksctl_bin  = data.external.eksctl.result.bin
}