gavinbunney / terraform-provider-kubectl

Terraform provider to handle raw kubernetes manifest yaml files
https://registry.terraform.io/providers/gavinbunney/kubectl
Mozilla Public License 2.0
619 stars 105 forks source link

This provider is broken on all Apple Silicon #189

Open bengaywins opened 2 years ago

bengaywins commented 2 years ago

Because this provider requires the hashicorp/template provider, which has been deprecated since 2020, I am unfortunately not able to use it. And this breaks things. The replacement is the templatefile function built into Terraform core with Terraform 0.12.

khaledavarteq commented 2 years ago

This issue affects me as well. Is anybody aware of any temporary fixes or workarounds? As long as this issue persists, I cannot use a significant number of our Terraform modules.

convexquad commented 2 years ago

Hey @gavinbunney this is Alex Bain from Woven Planet. Since they are giving all the new employees M1 Macs, we need to update to Terraform 1.0.2+ (since these versions include M1-compatible release binaries).

In TF 1.0.x, the template_file construct has been replaced with templatefile. Is there an easy change that we can make to https://github.com/gavinbunney/terraform-provider-kubectl/blob/master/kubernetes/data_source_kubectl_path_documents.go#L136 that will support TF 1.0.x+ (also without breaking older users of the provider)?

UPDATE: I may have spoken too soon. My teammate shared their stack trace and the provider is actually dying in a SIGSEV trying to access tmpfile.Name() at https://github.com/gavinbunney/terraform-provider-kubectl/blob/master/kubernetes/resource_kubectl_manifest.go#L477. I'll keep debugging to try to find the root cause.

UPDATE 2: the code gets tmpfile.Name() after Close() has already been called on the file. I suspect that on M1 Macs the File interface implementation deletes the underlying OS file pointer immediately upon Close() and that is the result of the SIGSEV. I think we just need to get the file name before it is closed; working with my teammate to confirm (they have an M1 Mac and I do not).

bengaywins commented 2 years ago

@convexquad There is a workaround. You can use the kubernetes provider and just use the kubernetes_manifest resource. The advantage here is you aren't taking arbitrary manifests and applying them. You are building the manifest using Terraform. To quickly migrate to using them, you can use a tool called tfk8s that will convert the yaml manifests to the kubernetes_manifest resource.

eytanhanig commented 2 years ago

@convexquad What did your research turn up? This provider increasingly results in signal: killed for me when dealing with many or large YAML files.