forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bigquerydatapolicy: support routine (GoogleCloudPlatform#10388)
- Loading branch information
Showing
4 changed files
with
169 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 17 additions & 17 deletions
34
mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
resource "google_bigquery_datapolicy_data_policy" "<%= ctx[:primary_resource_id] %>" { | ||
location = "us-central1" | ||
data_policy_id = "<%= ctx[:vars]['data_policy_id'] %>" | ||
policy_tag = google_data_catalog_policy_tag.policy_tag.name | ||
data_policy_type = "COLUMN_LEVEL_SECURITY_POLICY" | ||
} | ||
location = "us-central1" | ||
data_policy_id = "<%= ctx[:vars]['data_policy_id'] %>" | ||
policy_tag = google_data_catalog_policy_tag.policy_tag.name | ||
data_policy_type = "COLUMN_LEVEL_SECURITY_POLICY" | ||
} | ||
|
||
resource "google_data_catalog_policy_tag" "policy_tag" { | ||
taxonomy = google_data_catalog_taxonomy.taxonomy.id | ||
display_name = "Low security" | ||
description = "A policy tag normally associated with low security items" | ||
} | ||
resource "google_data_catalog_taxonomy" "taxonomy" { | ||
region = "us-central1" | ||
display_name = "<%= ctx[:vars]['taxonomy'] %>" | ||
description = "A collection of policy tags" | ||
activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] | ||
} | ||
resource "google_data_catalog_policy_tag" "policy_tag" { | ||
taxonomy = google_data_catalog_taxonomy.taxonomy.id | ||
display_name = "Low security" | ||
description = "A policy tag normally associated with low security items" | ||
} | ||
|
||
resource "google_data_catalog_taxonomy" "taxonomy" { | ||
region = "us-central1" | ||
display_name = "<%= ctx[:vars]['taxonomy'] %>" | ||
description = "A collection of policy tags" | ||
activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] | ||
} |
42 changes: 42 additions & 0 deletions
42
mmv1/templates/terraform/examples/bigquery_datapolicy_data_policy_routine.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
resource "google_bigquery_datapolicy_data_policy" "<%= ctx[:primary_resource_id] %>" { | ||
location = "us-central1" | ||
data_policy_id = "<%= ctx[:vars]['data_policy_id'] %>" | ||
policy_tag = google_data_catalog_policy_tag.policy_tag.name | ||
data_policy_type = "DATA_MASKING_POLICY" | ||
data_masking_policy { | ||
routine = google_bigquery_routine.custom_masking_routine.id | ||
} | ||
} | ||
|
||
resource "google_data_catalog_policy_tag" "policy_tag" { | ||
taxonomy = google_data_catalog_taxonomy.taxonomy.id | ||
display_name = "Low security" | ||
description = "A policy tag normally associated with low security items" | ||
} | ||
|
||
resource "google_data_catalog_taxonomy" "taxonomy" { | ||
region = "us-central1" | ||
display_name = "<%= ctx[:vars]['taxonomy'] %>" | ||
description = "A collection of policy tags" | ||
activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"] | ||
} | ||
|
||
resource "google_bigquery_dataset" "test" { | ||
dataset_id = "<%= ctx[:vars]['dataset_id'] %>" | ||
location = "us-central1" | ||
} | ||
|
||
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')" | ||
return_type = "{\"typeKind\" : \"STRING\"}" | ||
|
||
arguments { | ||
name = "ssn" | ||
data_type = "{\"typeKind\" : \"STRING\"}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters