to import a resource on tfstate in case of tfstate lost follow these steps:
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
}
}
terraform import google_container_cluster.<resource-name> projects/<project-id>/locations/<location>/clusters/<cluster-name>