I follow the rest of the examples, metrics server, dashboard, authenticating. All work fine.
Last step: terraform destroy
During the destroy, terraform-destroy.out.txt (100.7 KB), things just stop somewhere in the middle and I get this on stderr:
Error: Unauthorized
I do a second terraform destroy, terraform-destroy-2.out.txt (40.1 KB). More things get destroyed but again stops in the middle with Error: Unauthorized on stderr.
I do a third terraform destroy and this time it halts immediately, terraform-destroy-3.out.txt (3.8 KB). With this on stderr:
After that, a final destroy succeeds with 0 resources destroyed.
Could this be a bug in terraform or the eks module or is there a better example I could be following as a basis for my first Terraform-managed EKS environemnt?
I am getting the same error. I do not think that this is an AWS IAM related error, as terraform tries to reach a local endpoint: http://localhost/api/v1/namespaces/kube-system/configmaps/aws-auth ?
After spending more time with this, it seems it is still an intermittent issue with the latest versions of providers. Sometimes it works, sometimes it doesn’t.
My current best guess is having expired kubernetes auth tokens. So, after I get the first Unauthorized error, doing a terraform refresh before the next terraform destroy seems to get things working. No need to force removing from state.
I hope this can get fixed but until then I’ll build a habit of doing a refresh before a destroy.
I have the exact same error. It seems related with the auth-map.
It is the same terraform template that for 1 year and this error has started to appear only from few months. I don’t know if it is due to the upgrade of providers version or the terraform new version.
I just ran in to this. Performing a refresh before a destroy did not solve my problem. I had to remove the module.eks.kubernetes_config_map.aws_auth[0] from my state in order to proceed with the destroy.
I hit the same as you guys and when tried deleting it from the state terraform state rm module.eks.kubernetes_config_map.aws_auth[0]
However, it was complaining unable to find that even terraform state list shows it. I was only successful when put in commas terraform state rm 'module.eks.kubernetes_config_map.aws_auth[0]'