-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Terraform Support for Dataplex Glossary #13095
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
Open
Sachin-Rungta
wants to merge
50
commits into
GoogleCloudPlatform:main
Choose a base branch
from
Sachin-Rungta:terraform-glossary
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
f225c95
terraform glossary implementation
Sachin-Rungta 79adfe9
fix-lint
Sachin-Rungta 4971e14
update file name
Sachin-Rungta 6f704e1
update optional to required
Sachin-Rungta 5f093b6
update field
Sachin-Rungta 6fc51ff
update type
Sachin-Rungta c4cd312
update yaml
Sachin-Rungta e268444
update IAM policy
Sachin-Rungta 9c385c3
updated tmpl code
Sachin-Rungta cc212f7
update tmpl code
Sachin-Rungta 6126d36
remove project from resources
Sachin-Rungta 0c31d8c
updated tmpl
Sachin-Rungta 1d3cf6d
update unit test
Sachin-Rungta be520aa
update test
Sachin-Rungta a0b28e8
update test
Sachin-Rungta 1d00422
update yaml
Sachin-Rungta 16ce8cf
update unit test
Sachin-Rungta f6c41c8
update tmpl
Sachin-Rungta 1534689
update test
Sachin-Rungta 930c1f4
add project
Sachin-Rungta c2cc5b5
update url
Sachin-Rungta a0c14ee
add version
Sachin-Rungta 76ed34a
update version
Sachin-Rungta d2ef220
add min version
Sachin-Rungta 8d0d91f
update product.yaml
Sachin-Rungta d9913d9
update test
Sachin-Rungta 69fdc07
Merge remote-tracking branch 'origin' into terraform-glossary
Sachin-Rungta e837d94
add test
Sachin-Rungta d6198b0
update status to beta
Sachin-Rungta 0d23ebb
typo in provider
Sachin-Rungta 14c7274
update test with beta
Sachin-Rungta 08fcec9
add if condition
Sachin-Rungta 3b13d65
update go file with tmpl
Sachin-Rungta 9c530bb
update product.yaml
Sachin-Rungta db19784
Merge branch 'main' into terraform-glossary
Sachin-Rungta 9d7065e
update min version
Sachin-Rungta 9ddd666
Revert "update min version"
Sachin-Rungta f2b6fc3
add etag
Sachin-Rungta d46521b
remove etag
Sachin-Rungta d0e8bb6
remove glossary_id from import format
Sachin-Rungta 69686a7
apply fixes related to project removal
Sachin-Rungta 6acc0f1
remove beta as a provider
Sachin-Rungta f85585a
added plancheck import
Sachin-Rungta a94e749
update import key
Sachin-Rungta 8f7af41
Merge branch 'main' into terraform-glossary
Sachin-Rungta 3bfc21f
minor fixes:
Sachin-Rungta eb87f7e
Merge branch 'main' into terraform-glossary
Sachin-Rungta 0381efb
minor fixes
Sachin-Rungta 4b491a3
updated update function
Sachin-Rungta ac88aca
update testId
Sachin-Rungta 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,112 @@ | ||
# 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: 'Glossary' | ||
description: | | ||
Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. | ||
base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' | ||
melinath marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' | ||
create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id={{glossary_id}}' | ||
update_verb: 'PATCH' | ||
update_mask: true | ||
timeouts: | ||
insert_minutes: 5 | ||
update_minutes: 5 | ||
delete_minutes: 5 | ||
autogen_async: true | ||
import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}'] | ||
async: | ||
actions: ['create', 'delete', 'update'] | ||
type: 'OpAsync' | ||
operation: | ||
base_url: '{{op_id}}' | ||
iam_policy: | ||
method_name_separator: ':' | ||
parent_resource_attribute: 'glossary_id' | ||
import_format: | ||
- 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' | ||
Sachin-Rungta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- '{{glossary_id}}' | ||
examples: | ||
- name: 'dataplex_glossary_basic' | ||
primary_resource_id: 'glossary_test_id' | ||
primary_resource_name: 'fmt.Sprintf("tf-test-glossary-basic%s", context["random_suffix"])' | ||
vars: | ||
glossary_name: 'glossary-basic' | ||
- name: 'dataplex_glossary_full' | ||
primary_resource_id: 'glossary_test_id_full' | ||
primary_resource_name: 'fmt.Sprintf("tf-test-glossary-full%s", context["random_suffix"])' | ||
vars: | ||
glossary_name: 'glossary-full' | ||
parameters: | ||
- name: 'location' | ||
type: String | ||
description: | | ||
The location where the glossary should reside. | ||
url_param_only: true | ||
required: true | ||
immutable: true | ||
- name: 'glossaryId' | ||
type: String | ||
description: | | ||
The glossary id for creation. | ||
url_param_only: true | ||
melinath marked this conversation as resolved.
Show resolved
Hide resolved
|
||
required: true | ||
immutable: true | ||
properties: | ||
- name: 'name' | ||
type: String | ||
description: | | ||
The resource name of the Glossary. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} | ||
output: true | ||
- name: 'displayName' | ||
type: String | ||
description: | | ||
User friendly display name of the glossary. This is user-mutable. This will be same as the glossaryId, if not specified. | ||
required: false | ||
melinath marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: 'description' | ||
type: String | ||
description: | | ||
The user-mutable description of the glossary. | ||
required: false | ||
- name: 'labels' | ||
type: KeyValueLabels | ||
description: | | ||
User-defined labels for the Glossary. | ||
required: false | ||
- name: 'uid' | ||
type: String | ||
description: | | ||
System generated unique id for the Glossary. This ID will be different if the Glossary is deleted and re-created with the same name. | ||
output: true | ||
- name: 'createTime' | ||
type: Timestamp | ||
description: | | ||
The time at which the glossary was created. | ||
output: true | ||
- name: 'updateTime' | ||
type: Timestamp | ||
description: | | ||
The time at which the glossary was last updated. | ||
output: true | ||
- name: 'termCount' | ||
type: Integer | ||
description: | | ||
The number of terms in the glossary. | ||
required: false | ||
output: true | ||
- name: 'categoryCount' | ||
type: Integer | ||
description: | | ||
The number of categories in the glossary. | ||
required: false | ||
output: true |
4 changes: 4 additions & 0 deletions
4
mmv1/templates/terraform/examples/dataplex_glossary_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,4 @@ | ||||||||
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
glossary_id = "{{index $.Vars "glossary_name"}}" | ||||||||
location = "us-central1" | ||||||||
} |
8 changes: 8 additions & 0 deletions
8
mmv1/templates/terraform/examples/dataplex_glossary_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,8 @@ | ||
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { | ||
Sachin-Rungta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
glossary_id = "{{index $.Vars "glossary_name"}}" | ||
location = "us-central1" | ||
|
||
labels = { "tag": "test-tf" } | ||
display_name = "terraform glossary" | ||
description = "glossary created by Terraform" | ||
} |
73 changes: 73 additions & 0 deletions
73
mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.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,73 @@ | ||
package dataplex_test | ||
|
||
{{- if ne $.TargetVersionName "ga" }} | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
"github.com/hashicorp/terraform-plugin-testing/plancheck" | ||
) | ||
|
||
func TestAccDataplexGlossary_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": acctest.RandString(t, 10), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataplexGlossary_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_dataplex_glossary.glossary_test_id_full", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, | ||
}, | ||
{ | ||
Config: testAccDataplexGlossary_full(context), | ||
melinath marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ConfigPlanChecks: resource.ConfigPlanChecks{ | ||
PreApply: []plancheck.PlanCheck{ | ||
plancheck.ExpectResourceAction("google_dataplex_glossary.glossary_test_id_full", plancheck.ResourceActionUpdate), | ||
}, | ||
}, | ||
}, | ||
{ | ||
ResourceName: "google_dataplex_glossary.glossary_test_id_full", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataplexGlossary_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_dataplex_glossary" "glossary_test_id_full" { | ||
glossary_id = "tf-test-glossary-full%{random_suffix}" | ||
location = "us-central1" | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccDataplexGlossary_full(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_dataplex_glossary" "glossary_test_id_full" { | ||
glossary_id = "tf-test-glossary-full%{random_suffix}" | ||
location = "us-central1" | ||
labels = { "tag": "test-tf" } | ||
display_name = "terraform glossary" | ||
description = "glossary created by Terraform" | ||
} | ||
Sachin-Rungta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`, context) | ||
} | ||
|
||
{{- end }} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.