Skip to content

Commit

Permalink
bq analyticshub listing - add support for restrictedExportConfig (Goo…
Browse files Browse the repository at this point in the history
…gleCloudPlatform#9661)

* bq analyticshub listing - add support for restrictedExportConfig

* lint

* Update mmv1/products/bigqueryanalyticshub/Listing.yaml

---------

Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
  • Loading branch information
2 people authored and balanaguharsha committed May 2, 2024
1 parent 16c5f64 commit ecbc730
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mmv1/products/bigqueryanalyticshub/Listing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ examples:
data_exchange_id: 'my_data_exchange'
listing_id: 'my_listing'
description: 'example data exchange'
- !ruby/object:Provider::Terraform::Examples
name: 'bigquery_analyticshub_listing_restricted'
primary_resource_id: 'listing'
primary_resource_name: "fmt.Sprintf(\"tf_test_my_data_exchange%s\",
context[\"\
random_suffix\"]), fmt.Sprintf(\"tf_test_my_listing%s\",
context[\"random_suffix\"\
])"
region_override: 'US'
vars:
data_exchange_id: 'my_data_exchange'
listing_id: 'my_listing'
description: 'example data exchange'
properties:
- !ruby/object:Api::Type::String
name: name
Expand Down Expand Up @@ -146,3 +159,15 @@ properties:
projects/myproject/datasets/123
required: true
diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress'
- !ruby/object:Api::Type::NestedObject
name: restrictedExportConfig
description: If set, restricted export configuration will be propagated and enforced on the linked dataset.
properties:
- !ruby/object:Api::Type::Boolean
name: 'enabled'
description:
If true, enable restricted export.
- !ruby/object:Api::Type::Boolean
name: 'restrictQueryResult'
description:
If true, restrict export of query result derived from restricted linked dataset table.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "google_bigquery_analytics_hub_data_exchange" "<%= ctx[:primary_resource_id] %>" {
location = "US"
data_exchange_id = "<%= ctx[:vars]['data_exchange_id'] %>"
display_name = "<%= ctx[:vars]['data_exchange_id'] %>"
description = "<%= ctx[:vars]['description'] %>"
}

resource "google_bigquery_analytics_hub_listing" "<%= ctx[:primary_resource_id] %>" {
location = "US"
data_exchange_id = google_bigquery_analytics_hub_data_exchange.<%= ctx[:primary_resource_id] %>.data_exchange_id
listing_id = "<%= ctx[:vars]['listing_id'] %>"
display_name = "<%= ctx[:vars]['listing_id'] %>"
description = "<%= ctx[:vars]['description'] %>"

bigquery_dataset {
dataset = google_bigquery_dataset.<%= ctx[:primary_resource_id] %>.id
}

restricted_export_config {
enabled = true
restrict_query_result = true
}
}

resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" {
dataset_id = "<%= ctx[:vars]['listing_id'] %>"
friendly_name = "<%= ctx[:vars]['listing_id'] %>"
description = "<%= ctx[:vars]['description'] %>"
location = "US"
}

0 comments on commit ecbc730

Please sign in to comment.