From 6c94bb2acde7594e8ec7bc01a183445fea7412da Mon Sep 17 00:00:00 2001 From: Mauricio Alvarez Leon <65101411+BBBmau@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:39:48 -0700 Subject: [PATCH] add `dataGovernanceType` field to `bigquery_routine` resource (#9859) --- mmv1/products/bigquery/Routine.yaml | 11 +++++++++++ ...igquery_routine_data_governance_type.tf.erb | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 mmv1/templates/terraform/examples/bigquery_routine_data_governance_type.tf.erb diff --git a/mmv1/products/bigquery/Routine.yaml b/mmv1/products/bigquery/Routine.yaml index 3dbbfd3b0577..dc95d0bfadc7 100644 --- a/mmv1/products/bigquery/Routine.yaml +++ b/mmv1/products/bigquery/Routine.yaml @@ -73,6 +73,12 @@ examples: dataset_id: 'dataset_id' connection_id: 'connection_id' routine_id: 'routine_id' + - !ruby/object:Provider::Terraform::Examples + name: 'bigquery_routine_data_governance_type' + primary_resource_id: 'custom_masking_routine' + vars: + dataset_id: 'dataset_id' + routine_id: 'routine_id' - !ruby/object:Provider::Terraform::Examples skip_test: true name: 'bigquery_routine_remote_function' @@ -233,6 +239,11 @@ properties: - :DETERMINISM_LEVEL_UNSPECIFIED - :DETERMINISTIC - :NOT_DETERMINISTIC + - !ruby/object:Api::Type::Enum + name: 'dataGovernanceType' + description: If set to DATA_MASKING, the function is validated and made available as a masking function. For more information, see https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask + values: + - :DATA_MASKING - !ruby/object:Api::Type::NestedObject name: 'sparkOptions' description: | diff --git a/mmv1/templates/terraform/examples/bigquery_routine_data_governance_type.tf.erb b/mmv1/templates/terraform/examples/bigquery_routine_data_governance_type.tf.erb new file mode 100644 index 000000000000..8eea59a86de5 --- /dev/null +++ b/mmv1/templates/terraform/examples/bigquery_routine_data_governance_type.tf.erb @@ -0,0 +1,18 @@ +resource "google_bigquery_dataset" "test" { + dataset_id = "tf_test_dataset_id%{random_suffix}" +} + +resource "google_bigquery_routine" "custom_masking_routine" { + dataset_id = google_bigquery_dataset.test.dataset_id + routine_id = "custom_masking_routine" + routine_type = "SCALAR_FUNCTION" + language = "SQL" + data_governance_type = "DATA_MASKING" + definition_body = "SAFE.REGEXP_REPLACE(ssn, '[0-9]', 'X')" + arguments { + name = "ssn" + data_type = "{\"typeKind\" : \"STRING\"}" + } + return_type = "{\"typeKind\" : \"STRING\"}" + } + \ No newline at end of file