I am trying to get list of tables in a bigquery dataset using terraform data source inside a module. I have written below code but it returns the entire path to the tables. I only need the table id.
data "google_bigquery_dataset" "dataset" {
dataset_id = "my-dataset"
project = "my-project"
}
output "bq_tables" {
value = data.google_bigquery_dataset.dataset.access
}
I have checked the Google API documentation. The path it shows to the table list is given in this libnk. https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#DatasetReference
What I fail to understand is the syntax to use if possible after the access object.
e.g. I have tried be
low but it gives error Can’t access attributes on a set of objects. Did you mean to access an attribute across all elements of the set?
value = data.google_bigquery_dataset.dataset.access[0].view.tableId[0]
value = data.google_bigquery_dataset.dataset.access.view.tableId[0]
Deepesh P Belani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.