mumoshu / terraform-provider-eksctl

Manage AWS EKS clusters using Terraform and eksctl
Apache License 2.0
232 stars 44 forks source link

Fish-food dep repo deprecated #63

Open cilindrox opened 2 years ago

cilindrox commented 2 years ago

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?

cilindrox commented 2 years ago

cc @mumoshu

benjiro commented 1 year ago

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.

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

project0 commented 1 year ago

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.

cilindrox commented 1 year ago

@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 commented 1 year ago

@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.

project0 commented 1 year ago

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
}