Skip to content

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
wants to merge 50 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 Feb 18, 2025
79adfe9
fix-lint
Sachin-Rungta Feb 18, 2025
4971e14
update file name
Sachin-Rungta Feb 18, 2025
6f704e1
update optional to required
Sachin-Rungta Feb 18, 2025
5f093b6
update field
Sachin-Rungta Feb 18, 2025
6fc51ff
update type
Sachin-Rungta Feb 18, 2025
c4cd312
update yaml
Sachin-Rungta Feb 18, 2025
e268444
update IAM policy
Sachin-Rungta Feb 18, 2025
9c385c3
updated tmpl code
Sachin-Rungta Feb 18, 2025
cc212f7
update tmpl code
Sachin-Rungta Feb 18, 2025
6126d36
remove project from resources
Sachin-Rungta Feb 18, 2025
0c31d8c
updated tmpl
Sachin-Rungta Feb 18, 2025
1d3cf6d
update unit test
Sachin-Rungta Feb 18, 2025
be520aa
update test
Sachin-Rungta Feb 18, 2025
a0b28e8
update test
Sachin-Rungta Feb 18, 2025
1d00422
update yaml
Sachin-Rungta Feb 18, 2025
16ce8cf
update unit test
Sachin-Rungta Feb 18, 2025
f6c41c8
update tmpl
Sachin-Rungta Feb 18, 2025
1534689
update test
Sachin-Rungta Feb 18, 2025
930c1f4
add project
Sachin-Rungta Feb 19, 2025
c2cc5b5
update url
Sachin-Rungta Feb 19, 2025
a0c14ee
add version
Sachin-Rungta Feb 19, 2025
76ed34a
update version
Sachin-Rungta Feb 19, 2025
d2ef220
add min version
Sachin-Rungta Feb 19, 2025
8d0d91f
update product.yaml
Sachin-Rungta Feb 19, 2025
d9913d9
update test
Sachin-Rungta Feb 19, 2025
69fdc07
Merge remote-tracking branch 'origin' into terraform-glossary
Sachin-Rungta Feb 19, 2025
e837d94
add test
Sachin-Rungta Feb 19, 2025
d6198b0
update status to beta
Sachin-Rungta Feb 19, 2025
0d23ebb
typo in provider
Sachin-Rungta Feb 19, 2025
14c7274
update test with beta
Sachin-Rungta Feb 19, 2025
08fcec9
add if condition
Sachin-Rungta Feb 19, 2025
3b13d65
update go file with tmpl
Sachin-Rungta Feb 19, 2025
9c530bb
update product.yaml
Sachin-Rungta Feb 19, 2025
db19784
Merge branch 'main' into terraform-glossary
Sachin-Rungta May 8, 2025
9d7065e
update min version
Sachin-Rungta May 8, 2025
9ddd666
Revert "update min version"
Sachin-Rungta May 8, 2025
f2b6fc3
add etag
Sachin-Rungta May 8, 2025
d46521b
remove etag
Sachin-Rungta May 8, 2025
d0e8bb6
remove glossary_id from import format
Sachin-Rungta May 8, 2025
69686a7
apply fixes related to project removal
Sachin-Rungta May 9, 2025
6acc0f1
remove beta as a provider
Sachin-Rungta May 9, 2025
f85585a
added plancheck import
Sachin-Rungta May 9, 2025
a94e749
update import key
Sachin-Rungta May 12, 2025
8f7af41
Merge branch 'main' into terraform-glossary
Sachin-Rungta May 12, 2025
3bfc21f
minor fixes:
Sachin-Rungta May 12, 2025
eb87f7e
Merge branch 'main' into terraform-glossary
Sachin-Rungta May 12, 2025
0381efb
minor fixes
Sachin-Rungta May 12, 2025
4b491a3
updated update function
Sachin-Rungta May 12, 2025
ac88aca
update testId
Sachin-Rungta May 13, 2025
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
112 changes: 112 additions & 0 deletions mmv1/products/dataplex/Glossary.yaml
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'
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
name: 'Glossary'
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}}'
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}}'
- '{{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
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
- 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
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
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
provider = google-beta

glossary_id = "{{index $.Vars "glossary_name"}}"
location = "us-central1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
glossary_id = "{{index $.Vars "glossary_name"}}"
location = "us-central1"

labels = { "tag": "test-tf" }
display_name = "terraform glossary"
description = "glossary created by Terraform"
}
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),
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"
}
`, context)
}

{{- end }}
Loading