Skip to content

Commit

Permalink
update BigqueryDatapolicy to ga (#6797)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 authored Mar 14, 2023
1 parent f192271 commit d80d5d3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
7 changes: 3 additions & 4 deletions mmv1/products/bigquerydatapolicy/DataPolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

--- !ruby/object:Api::Resource
---
!ruby/object:Api::Resource
name: "DataPolicy"
min_version: beta
base_url: projects/{{project}}/locations/{{location}}/dataPolicies
create_url: projects/{{project}}/locations/{{location}}/dataPolicies
self_link: projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}
Expand All @@ -32,7 +32,7 @@ iam_policy: !ruby/object:Api::Resource::IamPolicy
import_format:
[
"projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}",
"{{data_policy_id}}"
"{{data_policy_id}}",
]
properties:
- !ruby/object:Api::Type::String
Expand Down Expand Up @@ -84,4 +84,3 @@ properties:
- :FIRST_FOUR_CHARACTERS
- :EMAIL_MASK
- :DATE_YEAR_MASK

3 changes: 3 additions & 0 deletions mmv1/products/bigquerydatapolicy/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ versions:
- !ruby/object:Api::Product::Version
name: beta
base_url: https://bigquerydatapolicy.googleapis.com/v1/
- !ruby/object:Api::Product::Version
name: ga
base_url: https://bigquerydatapolicy.googleapis.com/v1/
apis_required:
- !ruby/object:Api::Product::ApiReference
name: BigQuery Data Policy API
Expand Down
3 changes: 1 addition & 2 deletions mmv1/products/bigquerydatapolicy/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ overrides: !ruby/object:Overrides::ResourceOverrides
[
"projects/{{project}}/locations/{{location}}/dataPolicies/{{data_policy_id}}",
"{{project}}/{{location}}/{{data_policy_id}}",
"{{location}}/{{data_policy_id}}"
"{{location}}/{{data_policy_id}}",
]
examples:
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_datapolicy_data_policy_basic"
min_version: beta
primary_resource_id: "data_policy"
primary_resource_name: 'fmt.Sprintf("tf_test_data_policy%s", context["random_suffix"])'
vars:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
resource "google_bigquery_datapolicy_data_policy" "<%= ctx[:primary_resource_id] %>" {
provider = google-beta
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" {
provider = google-beta
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" {
provider = google-beta
region = "us-central1"
display_name = "<%= ctx[:vars]['taxonomy'] %>"
description = "A collection of policy tags"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<% autogen_exception -%>
package google

<% unless version == 'ga' -%>

import (
"testing"

Expand All @@ -18,7 +15,7 @@ func TestAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(t *t

VcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: TestAccProvidersOiCS,
Providers: TestAccProviders,
CheckDestroy: testAccCheckBigqueryDatapolicyDataPolicyDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand All @@ -40,29 +37,25 @@ func TestAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(t *t
func testAccBigqueryDatapolicyDataPolicy_bigqueryDatapolicyDataPolicyUpdate(context map[string]interface{}) string {
return Nprintf(`
resource "google_bigquery_datapolicy_data_policy" "data_policy" {
provider = google-beta
location = "us-central1"
data_policy_id = "tf_test_data_policy%{random_suffix}"
policy_tag = google_data_catalog_policy_tag.policy_tag_updated.name
data_policy_type = "COLUMN_LEVEL_SECURITY_POLICY"
}
resource "google_data_catalog_policy_tag" "policy_tag" {
provider = google-beta
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_policy_tag" "policy_tag_updated" {
provider = google-beta
taxonomy = google_data_catalog_taxonomy.taxonomy.id
display_name = "Low security updated"
description = "A policy tag normally associated with low security items"
}
resource "google_bigquery_datapolicy_data_policy" "policy_tag_with_data_masking_policy" {
provider = google-beta
location = "us-central1"
data_policy_id = "masking_policy_test"
policy_tag = google_data_catalog_policy_tag.policy_tag_updated.name
Expand All @@ -73,13 +66,10 @@ resource "google_bigquery_datapolicy_data_policy" "data_policy" {
}
resource "google_data_catalog_taxonomy" "taxonomy" {
provider = google-beta
region = "us-central1"
display_name = "taxonomy%{random_suffix}"
description = "A collection of policy tags"
activated_policy_types = ["FINE_GRAINED_ACCESS_CONTROL"]
}
`, context)
}

<% end %>

0 comments on commit d80d5d3

Please sign in to comment.