-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Iam support dataplex data product #17775
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
hao-nan-li
merged 7 commits into
GoogleCloudPlatform:main
from
okvidhi:iam-support-dataplex-data-product
Jun 2, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4af3352
feat: promote Dataplex Data Product resources to GA and add service a…
okvidhi d5ecce8
chore: trigger build after adding override label
okvidhi e986e9e
feat: add IAM support for Dataplex Data Product
okvidhi f324b7d
Merge branch 'main' into iam-support-dataplex-data-product
okvidhi b356a4e
feat: fix IAM support with colon separator, plural roles, and verifie…
okvidhi d4a8c57
feat: add IAM support and access_approval_config for Dataplex Data Pr…
okvidhi 06091a4
test: add coverage for access_approval_config in Data Product full ex…
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
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
67 changes: 67 additions & 0 deletions
67
mmv1/third_party/terraform/services/dataplex/iam_dataplex_data_product_test.go
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,67 @@ | ||
| package dataplex_test | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "testing" | ||
|
|
||
| "github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
| "github.com/hashicorp/terraform-plugin-testing/terraform" | ||
| "github.com/hashicorp/terraform-provider-google/google/acctest" | ||
| ) | ||
|
|
||
| func TestAccDataplexDataProductIamMember_basic(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| context := map[string]interface{}{ | ||
| "data_product_id": "tf-test-dp-" + acctest.RandString(t, 10), | ||
| "role": "roles/dataplex.dataProductsViewer", | ||
| "member": "user:okvidhi@google.com", | ||
| } | ||
|
|
||
| acctest.VcrTest(t, resource.TestCase{ | ||
| PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
| ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: testAccDataplexDataProductIamMember_basic(context), | ||
| }, | ||
| { | ||
| ResourceName: "google_dataplex_data_product_iam_member.member", | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| // FIX: Added function to construct the space-separated import ID | ||
|
okvidhi marked this conversation as resolved.
|
||
| ImportStateIdFunc: testAccDataplexDataProductIamMemberImportStateId("google_dataplex_data_product_iam_member.member"), | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| // Helper to build the "resource_name role member" string required for import | ||
| func testAccDataplexDataProductIamMemberImportStateId(resourceName string) func(*terraform.State) (string, error) { | ||
| return func(s *terraform.State) (string, error) { | ||
| rs, ok := s.RootModule().Resources[resourceName] | ||
| if !ok { | ||
| return "", fmt.Errorf("Not found: %s", resourceName) | ||
| } | ||
|
|
||
| return fmt.Sprintf("%s %s %s", rs.Primary.Attributes["data_product_id"], rs.Primary.Attributes["role"], rs.Primary.Attributes["member"]), nil | ||
| } | ||
| } | ||
|
|
||
| func testAccDataplexDataProductIamMember_basic(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` | ||
| resource "google_dataplex_data_product" "example" { | ||
| location = "us-central1" | ||
| data_product_id = "%{data_product_id}" | ||
| display_name = "iam test product" | ||
| owner_emails = ["terraform-test@google.com"] | ||
| } | ||
|
|
||
| resource "google_dataplex_data_product_iam_member" "member" { | ||
| # Passes the parent's full .name attribute to satisfy Dataplex identity rules | ||
| data_product_id = google_dataplex_data_product.example.name | ||
| role = "%{role}" | ||
| member = "%{member}" | ||
| } | ||
| `, context) | ||
| } | ||
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.