Add support for billing export in 0-org-setup (#3347)
* Add support for billing export in 0-org-setup * Merge branch 'master' into add-billing-export-support * Refactored billing export with adding support for bigquery_datasets in project_factory * Renamed bigquery_dataset to datasets * Fixed defaults.schema.md * Fixed default.schema.md again * Cleanup md's * Fixed boilerplate * Fixed JSON schema * reword README, rename project file * Moved dataset_id to the key of the map --------- Co-authored-by: Julio Castillo <jccb@google.com> Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
44
modules/project-factory/projects-bigquery.tf
Normal file
44
modules/project-factory/projects-bigquery.tf
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
locals {
|
||||
projects_bigquery_datasets = flatten([
|
||||
for k, v in local.projects_input : [
|
||||
for name, opts in lookup(v, "datasets", {}) : {
|
||||
project_key = k
|
||||
project_name = v.name
|
||||
id = name
|
||||
friendly_name = lookup(opts, "friendly_name", null)
|
||||
location = lookup(opts, "location", null)
|
||||
}
|
||||
]
|
||||
])
|
||||
}
|
||||
|
||||
module "bigquery-datasets" {
|
||||
source = "../bigquery-dataset"
|
||||
for_each = {
|
||||
for k in local.projects_bigquery_datasets : "${k.project_key}/${k.id}" => k
|
||||
}
|
||||
project_id = module.projects[each.value.project_key].project_id
|
||||
id = each.value.id
|
||||
friendly_name = each.value.friendly_name
|
||||
location = coalesce(
|
||||
local.data_defaults.overrides.bigquery_location,
|
||||
lookup(each.value, "location", null),
|
||||
local.data_defaults.defaults.bigquery_location
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user