kinvolk-archives / lokomotive-kubernetes

Lokomotive is a 100% open-source Kubernetes distribution from the folks at Kinvolk
https://kinvolk.io
MIT License
144 stars 20 forks source link

(packet?) Can't run terraform plan/apply #158

Closed DGollings closed 4 years ago

DGollings commented 4 years ago

On master (2512344), can't run anything terraform related really. I disabled all modules except for worker/controller, didn't help. Not much more I can think of to help fix this right now.

Following error message:

Error: could not generate output checksum: lstat .terraform/modules/controller.bootkube/resources/charts/calico: no such file or directory

Error: could not generate output checksum: lstat .terraform/modules/controller.bootkube/resources/bootstrap-manifests: no such file or directory

Error: could not generate output checksum: lstat .terraform/modules/controller.bootkube/resources/charts/kubernetes: no such file or directory
invidian commented 4 years ago

@DGollings thanks for reporting. maybe you can try removing . terraform directory and running terraform init again?

DGollings commented 4 years ago

Already tried that in order to get back to an older commit, think I had to remove tfstate as well (on s3). Will try later and let you know, thanks

On Mon, Feb 3, 2020, at 9:38 PM, Mateusz Gozdek wrote:

@DGollings https://github.com/DGollings thanks for reporting. maybe you can try removing . terraform directory and running terraform init again?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kinvolk/lokomotive-kubernetes/issues/158?email_source=notifications&email_token=AAPQJN6Y7CFV7IUEVAM57I3RBB6DHA5CNFSM4KPKOZ2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKVJ5HY#issuecomment-581607071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPQJN2JLKFTW3PDCJOTQCTRBB6DHANCNFSM4KPKOZ2A.

invidian commented 4 years ago

@DGollings I checked it and there is indeed an issue when updating to 2512344, I was able to reproduce it.

The problem is that template_dir resource from bootkube module holds the reference to the old path to bootkube module generated by Terraform via source_dir parameter. Then when planning, it tries to stat it and returns an error if the path does not exist anymore.

I'm not sure if that's the right approach yet, but it seems, that removing those resources from state and letting Terraform recreate them solves the issue:

$ terraform state list  | grep template_dir | grep bootkube
module.controller.module.bootkube.template_dir.bootstrap-manifests
module.controller.module.bootkube.template_dir.calico[0]
module.controller.module.bootkube.template_dir.kubelet
module.controller.module.bootkube.template_dir.kubernetes
$ terraform state rm module.controller.module.bootkube.template_dir.bootstrap-manifests module.controller.module.bootkube.template_dir.calico[0] module.controller.module.bootkube.template_dir.kubelet module.controller.module.bootkube.template_dir.kubernetes
Removed module.controller.module.bootkube.template_dir.kubernetes
Removed module.controller.module.bootkube.template_dir.kubelet
Removed module.controller.module.bootkube.template_dir.bootstrap-manifests
Removed module.controller.module.bootkube.template_dir.calico[0]
Successfully removed 4 resource instance(s).

You can try this out.

Another workaround would be to create a symlink to satisfy terraform_dir:

ln -s ./controller/bootkube .terraform/modules/controller.bootkube

Then run terraform apply, so template_dir resources can update their path.

DGollings commented 4 years ago

Just now deleted .terraform and the (remote) terraform.tfstate and it 'compiles' again, seems to be a temporary bug/feature due to a large? refactor.

Thanks, closing this issue