I created a k8s eks cluster and all of it's resources within terraform but ran into some issues and deleted the cluster through the aws UI. Now when I try to run terraform I'm getting this error Error: Get "http://localhost/api/v1/persistentvolumes/efs-jupyter-shared-v2": dial tcp 127.0.0.1:80: connect: connection refused
for each of the resources. I tried commenting out all of the resources within terraform and running, and still got the same error. Any ideas how to proceed?
CodePudding user response:
You need to clean the terraform state:
First step is listing all the resources in the state:
terraform state list
Then you can delete the resources you deleted in AWS dashboard:
terraform state rm <resource_name>
Finally you can run your terraform code to recreate the resources.