I want to import an existing google bigquery dataset under my-project-s001, my_dataset
i added in my terragrunt.hcl file the below config
terraform {
source = “./multi”
}
inputs = {
project_id = “my-project-s001”
datasets = {
“my_dataset” = {
"dataset_id" = “my_dataset”,
"location" = "EU"
}
}
}
the module under multi/main.tf
Under multi/main.tf I have
resource "google_bigquery_dataset" "datasets" {
for_each = var.datasets
project = var.project_id
dataset_id = can(lookup(each.value, "dataset_id")) == true ? lookup(each.value, "dataset_id") : each.key
location = can(lookup(each.value, "location")) == true ? lookup(each.value, "location") : var.location
}
I got to the place where terragrunt.hcl file is there and do the below command
terragrunt import "google_bigquery_dataset.datasets[0]" "my-project-s001/my_dataset"
The import is successful. However when I see the state file. It doesn't have the dataset_id.