to import a resource on tfstate in case of tfstate lost follow these steps:

  1. Ordered List Itemfind the resource to import (in this example a cluster GKE)
    in this case we need to find the cluster name, and cluster location [ <cluster-name>,projects/<project-id>/locations/<location>/clusters/<cluster-name> ] the other requested information may change with the case
  2. define the resource in a tf file, for example import.tf with the contents:
    resource "google_container_cluster" "resource-name" {
      name               = "cluster-name"
      location           = "location"
      initial_node_count = 1
      network            = "projects/<project-id within the network>/global/networks/<network name>"
    
      master_authorized_networks_config {
        dynamic "cidr_blocks" {
          for_each = var.master_authorized_networks_cidr_blocks
          content {
            cidr_block   = cidr_blocks.value.cidr_block
            display_name = cidr_blocks.value.display_name
          }
        }
      }
      dns_config { # forces replacement
        cluster_dns        = "CLOUD_DNS" #it depends on original creation
        cluster_dns_domain = "domain.name" #it depends on original creation
        cluster_dns_scope  = "CLUSTER_SCOPE" #it depends on original creation
      }
      timeouts { #it depends on original creation
        create = null
        delete = null
        read   = null
        update = null
      }
    }
  3. importing resource issuing the command:
    terraform import google_container_cluster.<resource-name> projects/<project-id>/locations/<location>/clusters/<cluster-name>