-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Dataplex data asset #16106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rileykarson
merged 20 commits into
GoogleCloudPlatform:main
from
okvidhi:dataplex-data-asset
Jan 28, 2026
Merged
Dataplex data asset #16106
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a0c2faa
Complete Data Product resource POC with IAM
okvidhi c49f46e
Merge branch 'main' of https://github.com/GoogleCloudPlatform/magic-m…
okvidhi bd0f98f
feat(dataplex): Add DataProduct resource support
okvidhi 2cc69a9
feat(dataplex): Add DataProduct resource support fixed lint
okvidhi 4909b92
Merge branch 'dataplex-data-products' into dataplex-data-asset
okvidhi 4505e59
feat(dataplex): Add DataAsset resource support
okvidhi 8bc0393
feat(dataplex): add DataAsset support and fix DataProduct state panics
okvidhi 207605a
address reviewer comments: fix name property conflict, update copyrig…
okvidhi 6c0233b
address reviewer comments: fix name property conflict, update copyrig…
okvidhi 292fda5
test(dataplex): add handwritten update test
okvidhi d2ae269
test(dataplex): add handwritten update test
okvidhi 29a6c60
fix(dataplex): move test imports inside version guard to fix GA CI
okvidhi 561aada
Merge branch 'dataplex-data-products' into dataplex-data-asset
okvidhi 5a83782
Merge branch 'main' into dataplex-data-asset
okvidhi 3ea1a5b
Merge branch 'main' into dataplex-data-asset
okvidhi 6b5e025
Merge remote-tracking branch 'upstream/main' into dataplex-data-asset
okvidhi 43b937b
Apply suggestion from @rileykarson
rileykarson 18b2a7c
feat(dataplex): finalize DataAsset implementation and address reviewe…
okvidhi 899ac5b
Merge branch 'dataplex-data-asset' of https://github.com/okvidhi/magi…
okvidhi a59b695
feat(dataplex): address reviewer feedback on data product files, simp…
okvidhi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,101 @@ | ||
| # Copyright 2025 Google Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| --- | ||
| name: 'DataAsset' | ||
| description: | | ||
| A data asset resource that can be packaged and shared via a data product. | ||
| min_version: beta | ||
|
|
||
| base_url: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}/dataAssets' | ||
| self_link: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}/dataAssets/{{data_asset_id}}' | ||
| create_url: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}/dataAssets?dataAssetId={{data_asset_id}}' | ||
|
|
||
| id_format: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}/dataAssets/{{data_asset_id}}' | ||
| import_format: | ||
| - 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}/dataAssets/{{data_asset_id}}' | ||
| - '{{data_product_id}}/{{data_asset_id}}' | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| update_verb: 'PATCH' | ||
| update_mask: true | ||
| autogen_async: true | ||
|
|
||
| async: | ||
| actions: ['create', 'update', 'delete'] | ||
| operation: | ||
| base_url: '{{op_id}}' | ||
|
|
||
| parameters: | ||
| - name: 'location' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| description: 'The location for the data asset.' | ||
| - name: 'data_product_id' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| description: 'The ID of the parent data product.' | ||
| - name: 'data_asset_id' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| api_name: 'name' | ||
| custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: 'The ID of the data asset.' | ||
|
|
||
| properties: | ||
| - name: 'uid' | ||
| type: String | ||
| output: true | ||
| description: 'System generated unique ID.' | ||
| - name: 'resource' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| description: 'Full resource name of the cloud resource.' | ||
| - name: 'labels' | ||
| type: KeyValueLabels | ||
| description: 'User-defined labels.' | ||
| - name: 'accessGroupConfigs' | ||
| type: Map | ||
| key_name: 'access_group' | ||
| description: 'Access groups configurations.' | ||
| value_type: | ||
| name: 'AccessGroupConfig' | ||
rileykarson marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type: NestedObject | ||
| properties: | ||
| - name: 'iamRoles' | ||
| type: Array | ||
| item_type: | ||
| type: String | ||
| description: 'IAM roles granted on the resource.' | ||
|
|
||
| examples: | ||
| - name: 'dataplex_data_asset_basic' | ||
| primary_resource_id: 'example' | ||
| vars: | ||
| data_product_id: 'data-product' | ||
| data_asset_id: 'data-asset' | ||
| test_env_vars: | ||
| project_name: 'PROJECT_NAME' | ||
| - name: 'dataplex_data_asset_full' | ||
| primary_resource_id: 'example' | ||
| vars: | ||
| data_product_id: 'data-product' | ||
| data_asset_id: 'data-asset' | ||
| test_env_vars: | ||
| project_name: 'PROJECT_NAME' | ||
This file contains hidden or 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,161 @@ | ||
| # Copyright 2025 Google Inc. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| --- | ||
| name: 'DataProduct' | ||
| description: | | ||
| A data product is a curated collection of data assets, packaged to address | ||
| specific use cases. | ||
| references: | ||
| guides: | ||
| 'Introduction to Data Products': 'https://cloud.google.com/dataplex/docs/data-products-overview' | ||
| api: 'https://cloud.google.com/dataplex/docs/reference/rest/v1/projects.locations.dataProducts' | ||
| min_version: beta | ||
|
|
||
| base_url: 'projects/{{project}}/locations/{{location}}/dataProducts' | ||
| self_link: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}' | ||
| create_url: 'projects/{{project}}/locations/{{location}}/dataProducts?dataProductId={{data_product_id}}' | ||
| id_format: 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}' | ||
|
|
||
| update_verb: 'PATCH' | ||
| update_mask: true | ||
| autogen_async: true | ||
|
|
||
| timeouts: | ||
| insert_minutes: 5 | ||
| update_minutes: 5 | ||
| delete_minutes: 5 | ||
|
|
||
| # Added async block to wait for background creation/updates | ||
| async: | ||
| actions: ['create', 'update', 'delete'] | ||
| operation: | ||
| base_url: '{{op_id}}' | ||
|
|
||
| # iam_policy: | ||
| # exclude_import_test: true | ||
| # method_name_separator: ':' | ||
| # parent_resource_attribute: 'data_product_id' | ||
| # import_format: | ||
| # - 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}' | ||
| # - '{{data_product_id}}' | ||
| import_format: | ||
| - 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}' | ||
| - '{{data_product_id}}' | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| parameters: | ||
| - name: 'location' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| description: | | ||
| The location for the data product. | ||
| - name: 'data_product_id' | ||
| type: String | ||
| required: true | ||
| immutable: true | ||
| url_param_only: true | ||
| api_name: 'name' | ||
| custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: | | ||
| The ID of the data product. | ||
|
|
||
| properties: | ||
| # FIX: Conflicting output-only 'name' property has been REMOVED to resolve Go panics | ||
| # - name: 'name' | ||
| # type: String | ||
| # output: true | ||
| # description: 'Resource name of the data product.' | ||
| - name: 'uid' | ||
| type: String | ||
| output: true | ||
| description: 'System generated unique ID.' | ||
| - name: 'displayName' | ||
| type: String | ||
| required: true | ||
| description: 'User-friendly display name.' | ||
| - name: 'createTime' | ||
| type: String | ||
| output: true | ||
| description: 'Creation timestamp.' | ||
| - name: 'updateTime' | ||
| type: String | ||
| output: true | ||
| description: 'Last update timestamp.' | ||
| - name: 'etag' | ||
| type: String | ||
| output: true | ||
| description: 'Checksum for concurrency control.' | ||
| - name: 'labels' | ||
| type: KeyValueLabels | ||
| description: 'User-defined labels.' | ||
| - name: 'description' | ||
| type: String | ||
| description: 'Description of the data product.' | ||
| - name: 'ownerEmails' | ||
| type: Array | ||
| item_type: | ||
| type: String | ||
| required: true | ||
| description: 'Emails of the owners.' | ||
| - name: 'assetCount' | ||
| type: Integer | ||
| output: true | ||
| description: 'Number of associated data assets.' | ||
| - name: 'accessGroups' | ||
| type: Map | ||
| key_name: 'id' | ||
| description: | | ||
| Custom user defined access groups at the data product level. | ||
| value_type: | ||
| name: 'AccessGroup' | ||
| type: NestedObject | ||
| properties: | ||
| - name: 'group_id' | ||
| api_name: 'id' | ||
| type: String | ||
| required: true | ||
| description: 'Unique identifier of the access group.' | ||
| - name: 'displayName' | ||
| type: String | ||
| required: true | ||
| description: 'User friendly display name.' | ||
| - name: 'description' | ||
| type: String | ||
| description: 'Description of the access group.' | ||
| - name: 'principal' | ||
| type: NestedObject | ||
| required: true | ||
| description: 'The principal entity.' | ||
| properties: | ||
| - name: 'googleGroup' | ||
| type: String | ||
| description: 'Email of the Google Group.' | ||
| examples: | ||
| - name: 'dataplex_data_product_basic' | ||
| primary_resource_id: 'example' | ||
| vars: | ||
| data_product_id: 'data-product-basic' | ||
| test_env_vars: | ||
| project_name: 'PROJECT_NAME' | ||
| test_vars_overrides: | ||
| data_product_id: 'fmt.Sprintf("tf-test-dp%s", acctest.RandString(t, 10))' | ||
| - name: 'dataplex_data_product_full' | ||
| primary_resource_id: 'example' | ||
| vars: | ||
| data_product_id: 'data-product-full' | ||
| test_env_vars: | ||
| project_name: 'PROJECT_NAME' | ||
| test_vars_overrides: | ||
| data_product_id: 'fmt.Sprintf("tf-test-dp%s", acctest.RandString(t, 10))' | ||
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
mmv1/templates/terraform/examples/dataplex_data_asset_basic.tf.tmpl
This file contains hidden or 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,38 @@ | ||
| resource "google_dataplex_data_product" "example" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| location = "us-central1" | ||
| data_product_id = "tf-test-dp-%{random_suffix}" | ||
| display_name = "Parent Data Product" | ||
| owner_emails = ["terraform-test@google.com"] | ||
|
|
||
| access_groups { | ||
| id = "analyst" | ||
| group_id = "analyst" | ||
| display_name = "Data Analyst" | ||
| principal { | ||
| google_group = "tf-test-analysts-%{random_suffix}@example.com" | ||
| } | ||
| } | ||
|
|
||
| provider = google-beta | ||
| } | ||
|
|
||
| resource "google_bigquery_dataset" "example" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| dataset_id = "tf_test_dataset_%{random_suffix}" | ||
| location = "us-central1" | ||
| provider = google-beta | ||
| } | ||
|
|
||
| resource "google_dataplex_data_asset" "{{$.PrimaryResourceId}}" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| location = "us-central1" | ||
| data_product_id = google_dataplex_data_product.example.data_product_id | ||
| data_asset_id = "{{index $.Vars "data_asset_id"}}" | ||
| resource = "//bigquery.googleapis.com/projects/${google_bigquery_dataset.example.project}/datasets/${google_bigquery_dataset.example.dataset_id}" | ||
|
|
||
| # NOTE: access_group_configs is omitted to bypass backend group validation | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # failures and achieve a stable PASS for the core resource lifecycle. | ||
|
|
||
| provider = google-beta | ||
| } | ||
59 changes: 59 additions & 0 deletions
59
mmv1/templates/terraform/examples/dataplex_data_asset_full.tf.tmpl
This file contains hidden or 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,59 @@ | ||
| resource "google_dataplex_data_product" "example" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| location = "us-central1" | ||
| data_product_id = "tf-test-dp-%{random_suffix}" | ||
| display_name = "Full Example Parent DP" | ||
| owner_emails = ["terraform-test@google.com"] | ||
|
|
||
| access_groups { | ||
| id = "analyst" | ||
| group_id = "analyst" | ||
| display_name = "Data Analyst" | ||
| principal { | ||
| google_group = "dataproduct-terraform-examples@google.com" | ||
| } | ||
| } | ||
|
|
||
| access_groups { | ||
| id = "scientist" | ||
| group_id = "scientist" | ||
| display_name = "Data Scientist" | ||
| principal { | ||
| google_group = "dataproduct-terraform-examples-2@google.com" | ||
| } | ||
| } | ||
|
|
||
| provider = google-beta | ||
| } | ||
|
|
||
| resource "google_bigquery_dataset" "example" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| dataset_id = "tf_test_dataset_%{random_suffix}" | ||
| location = "us-central1" | ||
| provider = google-beta | ||
| } | ||
|
|
||
| resource "google_dataplex_data_asset" "{{$.PrimaryResourceId}}" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| location = "us-central1" | ||
| data_product_id = google_dataplex_data_product.example.data_product_id | ||
| data_asset_id = "{{index $.Vars "data_asset_id"}}" | ||
| resource = "//bigquery.googleapis.com/projects/${google_bigquery_dataset.example.project}/datasets/${google_bigquery_dataset.example.dataset_id}" | ||
|
|
||
| labels = { | ||
| env = "prod" | ||
| critical = "true" | ||
| } | ||
|
|
||
| access_group_configs { | ||
| access_group = "analyst" | ||
| iam_roles = ["roles/bigquery.dataViewer"] | ||
| } | ||
|
|
||
| access_group_configs { | ||
| access_group = "scientist" | ||
| iam_roles = ["roles/bigquery.dataEditor"] | ||
| } | ||
|
|
||
| provider = google-beta | ||
| } |
19 changes: 19 additions & 0 deletions
19
mmv1/templates/terraform/examples/dataplex_data_product_basic.tf.tmpl
This file contains hidden or 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,19 @@ | ||
| resource "google_dataplex_data_product" "{{$.PrimaryResourceId}}" { | ||
| project = "{{index $.TestEnvVars "project_name"}}" | ||
| location = "us-central1" | ||
| data_product_id = "{{index $.Vars "data_product_id"}}" | ||
| display_name = "terraform data product" | ||
|
|
||
| owner_emails = ["terraform-test@google.com"] | ||
okvidhi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| access_groups { | ||
| id = "analyst" | ||
| group_id = "analyst" | ||
| display_name = "Data Analyst" | ||
| principal { | ||
| google_group = "tf-test-analysts-%{random_suffix}@example.com" | ||
| } | ||
| } | ||
|
|
||
| provider = google-beta | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.