Dependency in Modules in terraform

I am trying to create datasets,tables and views in bigquery on gcp using terraform. i am using this module.

module “bigquery-tenant-datasets” {
for_each = var.tenant_datasets
source = “terraform-google-modules/bigquery/google”
version = “5.1.0”
dataset_id = each.value.datasetName
dataset_name = each.value.datasetName
description = each.value.datasetName
project_id = var.project_id
location = var.location
tables = [for table in var.tenant_tables: merge(table, {“schema”: file(table[“schema”])})]
views = [for view in var.tenant_views: merge(view, {“query”: replace(view[“query”], “tenantName”, each.value.datasetName)})]
dataset_labels = var.dataset_labels
}

The problem with this is the terraform currently needs to be ran multiple times, as the order of object creation is somewhat random…i.e views are tried to be created before tables exist. So it gave error sometimes.
What can i do here to resove this and ensure that tables are always created first and then views?

Would it make sense to use the module itself twice - one time for tables and the 2nd time for views?
If yes, you’d have to use outputs of the first usage within the views modules.