Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions mmv1/products/dataplex/DataAsset.yaml
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: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add references links here as well?

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}}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- '{{data_product_id}}/{{data_asset_id}}'

Same reasons as below


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'
Comment on lines +56 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
api_name: 'name'
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'

Same reasons as below

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'
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'
150 changes: 150 additions & 0 deletions mmv1/products/dataplex/DataProduct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Copyright 2026 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}}'

import_format:
- 'projects/{{project}}/locations/{{location}}/dataProducts/{{data_product_id}}'
- '{{data_product_id}}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- '{{data_product_id}}'

location always needs to be provided, I think?


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))'

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'
Comment on lines +80 to +81
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
api_name: 'name'
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'

These can be removed due to url_param_only: true

description: |
The ID of the data product.

properties:
- 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.'
2 changes: 2 additions & 0 deletions mmv1/products/dataplex/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ display_name: 'Dataplex'
versions:
- name: 'ga'
base_url: 'https://dataplex.googleapis.com/v1/'
- name: 'beta'
base_url: 'https://dataplex.googleapis.com/v1/'
scopes:
- 'https://www.googleapis.com/auth/cloud-platform'
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 = ["[email protected]"]

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on why this is needed? Internally would be fine.

# failures and achieve a stable PASS for the core resource lifecycle.

provider = google-beta
}
59 changes: 59 additions & 0 deletions mmv1/templates/terraform/examples/dataplex_data_asset_full.tf.tmpl
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 = ["[email protected]"]

access_groups {
id = "analyst"
group_id = "analyst"
display_name = "Data Analyst"
principal {
google_group = "[email protected]"
}
}

access_groups {
id = "scientist"
group_id = "scientist"
display_name = "Data Scientist"
principal {
google_group = "[email protected]"
}
}

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
}
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 = ["[email protected]"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
owner_emails = ["terraform-test@google.com"]
owner_emails = ["gterraformtestuser@gmail.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
}
Loading
Loading