|
| 1 | +# Copyright 2025 Google Inc. |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +# you may not use this file except in compliance with the License. |
| 4 | +# You may obtain a copy of the License at |
| 5 | +# |
| 6 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +# |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | + |
| 14 | +--- |
| 15 | +name: DataPolicy |
| 16 | +description: BigQuery Data Policy |
| 17 | +references: |
| 18 | + guides: |
| 19 | + 'Official Documentation': 'https://cloud.google.com/bigquery/docs/column-data-masking-intro' |
| 20 | + api: 'https://cloud.google.com/bigquery/docs/reference/bigquerydatapolicy/rest/v2/projects.locations.dataPolicies' |
| 21 | +docs: null |
| 22 | +id_format: 'projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}' |
| 23 | +base_url: 'projects/{{project}}/locations/{{location}}/dataPolicies' |
| 24 | +self_link: 'projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}' |
| 25 | +create_url: 'projects/{{project}}/locations/{{location}}/dataPolicies' |
| 26 | +update_verb: 'PATCH' |
| 27 | +update_mask: true |
| 28 | +import_format: |
| 29 | + - 'projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}' |
| 30 | + - '{{project}}/{{location}}/{{data_policy_id}}' |
| 31 | + - '{{location}}/{{data_policy_id}}' |
| 32 | +timeouts: |
| 33 | + insert_minutes: 20 |
| 34 | + update_minutes: 20 |
| 35 | + delete_minutes: 20 |
| 36 | +iam_policy: |
| 37 | + method_name_separator: ':' |
| 38 | + fetch_iam_policy_verb: 'POST' |
| 39 | + parent_resource_attribute: 'data_policy_id' |
| 40 | + example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' |
| 41 | + import_format: |
| 42 | + - 'projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}' |
| 43 | + - '{{data_policy_id}}' |
| 44 | +custom_code: |
| 45 | + encoder: templates/terraform/encoders/bigquery_datapolicyv2_datapolicy.go.tmpl |
| 46 | + update_encoder: templates/terraform/update_encoder/bigquery_datapolicyv2_datapolicy.go.tmpl |
| 47 | +examples: |
| 48 | + - name: 'bigquery_datapolicyv2_datapolicy_basic' |
| 49 | + primary_resource_id: 'basic_data_policy' |
| 50 | + primary_resource_name: 'fmt.Sprintf("tf_test_basic_data_policy%s", context["random_suffix"])' |
| 51 | + vars: |
| 52 | + data_policy_id: 'basic_data_policy' |
| 53 | + - name: 'bigquery_datapolicyv2_datapolicy_predefined_masking' |
| 54 | + primary_resource_id: 'predefined_masking_data_policy' |
| 55 | + primary_resource_name: 'fmt.Sprintf("tf_test_predefined_masking_data_policy%s", context["random_suffix"])' |
| 56 | + vars: |
| 57 | + data_policy_id: 'predefined_masking_data_policy' |
| 58 | + - name: 'bigquery_datapolicyv2_datapolicy_routine' |
| 59 | + primary_resource_id: 'routine_data_policy' |
| 60 | + primary_resource_name: 'fmt.Sprintf("tf_test_routine_data_policy%s", context["random_suffix"])' |
| 61 | + vars: |
| 62 | + data_policy_id: 'routine_data_policy' |
| 63 | + dataset_id: 'dataset_id' |
| 64 | + - name: 'bigquery_datapolicyv2_datapolicy_withgrantees' |
| 65 | + primary_resource_id: 'data_policy_with_grantees' |
| 66 | + primary_resource_name: 'fmt.Sprintf("tf_test_data_policy_with_grantees%s", context["random_suffix"])' |
| 67 | + exclude_test: true |
| 68 | + vars: |
| 69 | + data_policy_id: 'data_policy_with_grantees' |
| 70 | + - name: 'bigquery_datapolicyv2_datapolicy_withgrantees_test' |
| 71 | + primary_resource_id: 'data_policy_with_grantees' |
| 72 | + primary_resource_name: 'fmt.Sprintf("tf_test_data_policy_with_grantees%s", context["random_suffix"])' |
| 73 | + exclude_docs: true |
| 74 | + vars: |
| 75 | + data_policy_id: 'data_policy_with_grantees' |
| 76 | +parameters: |
| 77 | + - name: location |
| 78 | + type: String |
| 79 | + description: Resource ID segment making up resource `name`. It identifies the resource |
| 80 | + within its parent collection as described in https://google.aip.dev/122. |
| 81 | + immutable: true |
| 82 | + url_param_only: true |
| 83 | + required: true |
| 84 | +properties: |
| 85 | + - name: dataMaskingPolicy |
| 86 | + type: NestedObject |
| 87 | + description: The policy used to specify data masking rule. |
| 88 | + properties: |
| 89 | + - name: predefinedExpression |
| 90 | + type: String |
| 91 | + description: |- |
| 92 | + A predefined masking expression. |
| 93 | + Possible values: |
| 94 | + SHA256 |
| 95 | + ALWAYS_NULL |
| 96 | + DEFAULT_MASKING_VALUE |
| 97 | + LAST_FOUR_CHARACTERS |
| 98 | + FIRST_FOUR_CHARACTERS |
| 99 | + EMAIL_MASK |
| 100 | + DATE_YEAR_MASK |
| 101 | + RANDOM_HASH |
| 102 | + - name: routine |
| 103 | + type: String |
| 104 | + description: |- |
| 105 | + The name of the BigQuery routine that contains the custom masking |
| 106 | + routine, in the format of |
| 107 | + `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`. |
| 108 | + diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress' |
| 109 | + - name: dataPolicyType |
| 110 | + type: String |
| 111 | + description: |- |
| 112 | + Type of data policy. |
| 113 | + Possible values: |
| 114 | + DATA_MASKING_POLICY |
| 115 | + RAW_DATA_ACCESS_POLICY |
| 116 | + COLUMN_LEVEL_SECURITY_POLICY |
| 117 | + required: true |
| 118 | + - name: etag |
| 119 | + type: Fingerprint |
| 120 | + description: |- |
| 121 | + The etag for this Data Policy. |
| 122 | + This field is used for UpdateDataPolicy calls. If Data Policy exists, this |
| 123 | + field is required and must match the server's etag. It will also be |
| 124 | + populated in the response of GetDataPolicy, CreateDataPolicy, and |
| 125 | + UpdateDataPolicy calls. |
| 126 | + default_from_api: true |
| 127 | + - name: grantees |
| 128 | + type: Array |
| 129 | + description: |- |
| 130 | + The list of IAM principals that have Fine Grained Access to the underlying |
| 131 | + data goverened by this data policy. |
| 132 | +
|
| 133 | + Uses the [IAM V2 principal |
| 134 | + syntax](https://cloud.google.com/iam/docs/principal-identifiers#v2) Only |
| 135 | + supports principal types users, groups, serviceaccounts, cloudidentity. |
| 136 | + This field is supported in V2 Data Policy only. In case of V1 data policies |
| 137 | + (i.e. verion = 1 and policy_tag is set), this field is not populated. |
| 138 | + item_type: |
| 139 | + type: String |
| 140 | + default_from_api: true |
| 141 | + - name: name |
| 142 | + type: String |
| 143 | + description: |- |
| 144 | + Identifier. Resource name of this data policy, in the format of |
| 145 | + `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}`. |
| 146 | + output: true |
| 147 | + - name: policyTag |
| 148 | + type: String |
| 149 | + description: |- |
| 150 | + Policy tag resource name, in the format of |
| 151 | + `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/policyTags/{policyTag_id}`. |
| 152 | + policy_tag is supported only for V1 data policies. |
| 153 | + output: true |
| 154 | + - name: version |
| 155 | + type: String |
| 156 | + description: |- |
| 157 | + The version of the Data Policy resource. |
| 158 | + Possible values: |
| 159 | + V1 |
| 160 | + V2 |
| 161 | + output: true |
| 162 | + - name: dataPolicyId |
| 163 | + type: String |
| 164 | + description: |- |
| 165 | + User-assigned (human readable) ID of the data policy that needs to be |
| 166 | + unique within a project. Used as {data_policy_id} in part of the resource |
| 167 | + name. |
| 168 | + required: true |
0 commit comments