From 19a92ce015a6703585e47fae546beeedada8e958 Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Thu, 27 Feb 2025 05:20:44 +0000 Subject: [PATCH 1/2] feat: add env_vars output variable and update metadata --- README.md | 1 + metadata.yaml | 10 ++++++++++ outputs.tf | 12 ++++++++++++ 3 files changed, 23 insertions(+) diff --git a/README.md b/README.md index b6f1907e..70fc7abb 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,7 @@ This module provisions a dataset and a list of tables with associated JSON schem | bigquery\_external\_tables | Map of BigQuery external table resources being provisioned. | | bigquery\_tables | Map of bigquery table resources being provisioned. | | bigquery\_views | Map of bigquery view resources being provisioned. | +| env\_vars | Exported environment variables | | external\_table\_ids | Unique IDs for any external tables being provisioned | | external\_table\_names | Friendly names for any external tables being provisioned | | project | Project where the dataset and tables are created | diff --git a/metadata.yaml b/metadata.yaml index 15a5abbc..0c8d3574 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -329,6 +329,16 @@ spec: type: - object - {} + - name: env_vars + description: Exported environment variables + type: + - object + - BIGQUERY_DATASET: string + BIGQUERY_EXTERNAL_TABLES: string + BIGQUERY_MATERIALIZED_VIEWS: string + BIGQUERY_ROUTINES: string + BIGQUERY_TABLES: string + BIGQUERY_VIEWS: string - name: external_table_ids description: Unique IDs for any external tables being provisioned type: diff --git a/outputs.tf b/outputs.tf index 083a1563..71797d87 100644 --- a/outputs.tf +++ b/outputs.tf @@ -94,3 +94,15 @@ output "routine_ids" { ] description = "Unique IDs for any routine being provisioned" } + +output "env_vars" { + value = { + "BIGQUERY_DATASET" = google_bigquery_dataset.main.dataset_id + "BIGQUERY_TABLES" = join(",", [for table in google_bigquery_table.main : table.table_id]) + "BIGQUERY_VIEWS" = join(",", [for table in google_bigquery_table.view : table.table_id]) + "BIGQUERY_MATERIALIZED_VIEWS" = join(",", [for table in google_bigquery_table.materialized_view : table.table_id]) + "BIGQUERY_EXTERNAL_TABLES" = join(",", [for table in google_bigquery_table.external_table : table.table_id]) + "BIGQUERY_ROUTINES" = join(",", [for routine in google_bigquery_routine.routine : routine.routine_id]) + } + description = "Exported environment variables" +} From 8b46d4e8f80292bd1872bc697d681c809c181ba9 Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Fri, 28 Feb 2025 05:23:48 +0000 Subject: [PATCH 2/2] jsonencode env vars --- outputs.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/outputs.tf b/outputs.tf index 71797d87..025270a2 100644 --- a/outputs.tf +++ b/outputs.tf @@ -98,11 +98,11 @@ output "routine_ids" { output "env_vars" { value = { "BIGQUERY_DATASET" = google_bigquery_dataset.main.dataset_id - "BIGQUERY_TABLES" = join(",", [for table in google_bigquery_table.main : table.table_id]) - "BIGQUERY_VIEWS" = join(",", [for table in google_bigquery_table.view : table.table_id]) - "BIGQUERY_MATERIALIZED_VIEWS" = join(",", [for table in google_bigquery_table.materialized_view : table.table_id]) - "BIGQUERY_EXTERNAL_TABLES" = join(",", [for table in google_bigquery_table.external_table : table.table_id]) - "BIGQUERY_ROUTINES" = join(",", [for routine in google_bigquery_routine.routine : routine.routine_id]) + "BIGQUERY_TABLES" = jsonencode([for table in google_bigquery_table.main : table.table_id]) + "BIGQUERY_VIEWS" = jsonencode([for table in google_bigquery_table.view : table.table_id]) + "BIGQUERY_MATERIALIZED_VIEWS" = jsonencode([for table in google_bigquery_table.materialized_view : table.table_id]) + "BIGQUERY_EXTERNAL_TABLES" = jsonencode([for table in google_bigquery_table.external_table : table.table_id]) + "BIGQUERY_ROUTINES" = jsonencode([for routine in google_bigquery_routine.routine : routine.routine_id]) } description = "Exported environment variables" }