Persistent volume using aws ebs csi

I am trying to set up a persistent volume using aws ebs csi driver. Keep getting this error:

Error: Post "http://localhost/api/v1/persistentvolumes": dial tcp 127.0.0.1:80: connect: connection refused

The tf code is below

resource "kubernetes_persistent_volume" "example" {
  metadata {
    name = "example-ebs-pv"
  }
  spec {
    storage_class_name = "ebs-sc"
    persistent_volume_reclaim_policy = "Retain"
    capacity = {
      storage = "2Gi"
    }
    access_modes = ["ReadWriteMany"]
    persistent_volume_source {
        csi {
          driver = "ebs.csi.aws.com"
          volume_handle = "awsElasticBlockStore"
        }
    }
  }
}