From f7b532763d17d56b821c5c0940a8ba5d270cca5a Mon Sep 17 00:00:00 2001 From: JosieLi-Google <129235804+JosieLi-Google@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:43:32 -0500 Subject: [PATCH] add support for lastUpdatedPartitionConfig (#1191) * run ./scripts/regen.sh for unit test failure * test for genrated file check * test for genrated file check * Revert "run ./scripts/regen.sh for unit test failure" This reverts commit 6d64e0ab132e0bda558bddf52d0fbefd39739880. * updated genertaed file (not using ./scripts/regen.sh) * remove gen_check modification * regenerate docs * add support for lastUpdatedPartitionConfig * add support for lastUpdatedPartitionConfig * add support for lastUpdatedPartitionConfig * run ./scripts/regen.sh * will revert back later * correct project_data/main.tf * add support for lastUpdatedPartitionConfig * correct team.hcl * correct main.tf * ./scripts/regen.sh * update healthcare_datasets/main.tf and run ./scripts/regen.sh to correct project_data/main.tf --- docs/tfengine/schemas/resources.md | 3 +++ .../generated/team/project_data/main.tf | 8 ++++++-- examples/tfengine/modules/team.hcl | 6 +++++- .../resources/healthcare_datasets/main.tf | 8 ++++++-- templates/tfengine/recipes/resources.hcl | 17 +++++++++++++++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/tfengine/schemas/resources.md b/docs/tfengine/schemas/resources.md index ff6c958c5..6fabfaca7 100755 --- a/docs/tfengine/schemas/resources.md +++ b/docs/tfengine/schemas/resources.md @@ -168,6 +168,9 @@ | healthcare_datasets.fhir_stores.stream_configs.bigquery_destination | - | object | true | - | - | | healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.dataset_uri | - | string | true | - | - | | healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config | - | object | true | - | - | +| healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config.last_updated_partition_config | - | object | true | - | - | +| healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config.last_updated_partition_config.expiration_ms | - | integer | true | - | - | +| healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config.last_updated_partition_config.type | - | string | true | - | - | | healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config.recursive_structure_depth | - | integer | true | - | - | | healthcare_datasets.fhir_stores.stream_configs.bigquery_destination.schema_config.schema_type | - | string | false | - | - | | healthcare_datasets.fhir_stores.stream_configs.resource_types | - | array(string) | false | - | - | diff --git a/examples/tfengine/generated/team/project_data/main.tf b/examples/tfengine/generated/team/project_data/main.tf index 825811828..fc254d89c 100644 --- a/examples/tfengine/generated/team/project_data/main.tf +++ b/examples/tfengine/generated/team/project_data/main.tf @@ -170,9 +170,13 @@ module "healthcare_dataset" { bigquery_destination = { dataset_uri = "bq://example-prod-data.${module.one_billion_ms_dataset.bigquery_dataset.dataset_id}" schema_config = { - recursive_structure_depth = 3 + recursive_structure_depth = "3" + schema_type = "ANALYTICS" + last_updated_partition_config = { + expiration_ms = 1e+06 - schema_type = "ANALYTICS" + type = "HOUR" + } } } resource_types = ["Patient"] diff --git a/examples/tfengine/modules/team.hcl b/examples/tfengine/modules/team.hcl index 2f8bf0fa0..eb73785fb 100644 --- a/examples/tfengine/modules/team.hcl +++ b/examples/tfengine/modules/team.hcl @@ -435,7 +435,11 @@ template "project_data" { schema_config = { schema_type = "ANALYTICS" recursive_structure_depth = 3 - } + last_updated_partition_config = { + expiration_ms = 1e+06 + type = "HOUR" + } + } } }] }, diff --git a/templates/tfengine/components/resources/healthcare_datasets/main.tf b/templates/tfengine/components/resources/healthcare_datasets/main.tf index 4b616dce8..0906b0ab0 100644 --- a/templates/tfengine/components/resources/healthcare_datasets/main.tf +++ b/templates/tfengine/components/resources/healthcare_datasets/main.tf @@ -106,8 +106,12 @@ module "{{resourceName . "name"}}" { bigquery_destination = { dataset_uri = "{{$v.bigquery_destination.dataset_uri}}" schema_config = { - {{hcl $v.bigquery_destination.schema_config}} - } + recursive_structure_depth = "{{$v.bigquery_destination.schema_config.recursive_structure_depth}}" + schema_type = "{{$v.bigquery_destination.schema_config.schema_type}}" + last_updated_partition_config = { + {{hcl $v.bigquery_destination.schema_config.last_updated_partition_config}} + } + } } {{hclField $v "resource_types" -}} }, diff --git a/templates/tfengine/recipes/resources.hcl b/templates/tfengine/recipes/resources.hcl index 2e6c98d2d..08321f287 100644 --- a/templates/tfengine/recipes/resources.hcl +++ b/templates/tfengine/recipes/resources.hcl @@ -1047,6 +1047,7 @@ schema = { additionalProperties = false required = [ "recursive_structure_depth", + "last_updated_partition_config", ] properties = { schema_type = { @@ -1055,6 +1056,22 @@ schema = { recursive_structure_depth = { type = "integer" } + last_updated_partition_config = { + type = "object" + additionalProperties = false + required = [ + "type", + "expiration_ms", + ] + properties = { + type = { + type = "string" + } + expiration_ms = { + type = "integer" + } + } + } } } }