Skip to content

Terraform support for Category and Term Resources #13923

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 65 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 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
91e15d3
add terraform support for glossary category
Sachin-Rungta May 13, 2025
4800355
added blank line
Sachin-Rungta May 13, 2025
352d5f1
add glossary_id
Sachin-Rungta May 13, 2025
de09a9c
update tmpl
Sachin-Rungta May 13, 2025
ae6042b
update resource name
Sachin-Rungta May 13, 2025
0f12097
add location
Sachin-Rungta May 13, 2025
82a05cd
updated parent
Sachin-Rungta May 13, 2025
3ba2714
update parent name
Sachin-Rungta May 13, 2025
e88c570
update parent
Sachin-Rungta May 13, 2025
46add94
update parent
Sachin-Rungta May 13, 2025
588f86a
updated parent
Sachin-Rungta May 13, 2025
74094cd
update yaml
Sachin-Rungta May 13, 2025
1c23653
update categoryId to full
Sachin-Rungta May 13, 2025
bfb8dac
remove IAM
Sachin-Rungta May 13, 2025
c9fcc6a
add support for term
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
99 changes: 99 additions & 0 deletions mmv1/products/dataplex/Category.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2024 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: 'Category'
description: |
Represents a collection of categories and terms within a Glossary that are related to each other.
base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'
self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'
create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories?category_id={{category_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}}/categories/{{category_id}}']
examples:
- name: 'dataplex_category_basic'
primary_resource_id: 'category_test_id'
primary_resource_name: 'fmt.Sprintf("tf-test-category-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])'
vars:
category_name: 'category-basic'
- name: 'dataplex_category_full'
primary_resource_id: 'category_test_id_full'
primary_resource_name: 'fmt.Sprintf("tf-test-category-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])'
vars:
category_name: 'category-full'
parameters:
- name: 'location'
type: String
description: |
The location where the glossary category should reside.
url_param_only: true
required: true
immutable: true
- name: 'glossaryId'
type: String
description: |
The glossary id for creation.
url_param_only: true
immutable: true
- name: 'categoryId'
type: String
description: |
The category id for creation.
url_param_only: true
immutable: true
properties:
- name: 'name'
type: String
description: |
The resource name of the GlossaryCategory. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{categoryId}
output: true
- name: 'displayName'
type: String
description: |
User friendly display name of the GlossaryCategory. This is user-mutable. This will be same as the categoryId, if not specified.
required: false
- name: 'description'
type: String
description: |
The user-mutable description of the GlossaryCategory.
required: false
- name: 'labels'
type: KeyValueLabels
description: |
User-defined labels for the GlossaryCategory.
required: false
- name: 'uid'
type: String
description: |
System generated unique id for the GlossaryCategory. This ID will be different if the GlossaryCategory is deleted and re-created with the same name.
output: true
- name: 'createTime'
type: Timestamp
description: |
The time at which the GlossaryCategory was created.
output: true
- name: 'updateTime'
type: Timestamp
description: |
The time at which the GlossaryCategory was last updated.
output: true
- name: 'parent'
type: String
description: |
The immediate parent of the GlossaryCategory in the resource-hierarchy. It can either be a Glossary or a Category. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} OR projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{categoryId}
required: true
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'
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
99 changes: 99 additions & 0 deletions mmv1/products/dataplex/Term.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Copyright 2024 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: 'Term'
description: |
Represents a collection of terms within a Glossary that are related to each other.
base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}'
self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}'
create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms?term_id={{term_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}}/terms/{{term_id}}']
examples:
- name: 'dataplex_term_basic'
primary_resource_id: 'term_test_id'
primary_resource_name: 'fmt.Sprintf("tf-test-term-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])'
vars:
term_name: 'term-basic'
- name: 'dataplex_term_full'
primary_resource_id: 'term_test_id_full'
primary_resource_name: 'fmt.Sprintf("tf-test-term-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])'
vars:
term_name: 'term-full'
parameters:
- name: 'location'
type: String
description: |
The location where the glossary term should reside.
url_param_only: true
required: true
immutable: true
- name: 'glossaryId'
type: String
description: |
The glossary id for creation.
url_param_only: true
immutable: true
- name: 'termId'
type: String
description: |
The term id for creation.
url_param_only: true
immutable: true
properties:
- name: 'name'
type: String
description: |
The resource name of the GlossaryTerm. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{termId}
output: true
- name: 'displayName'
type: String
description: |
User friendly display name of the GlossaryTerm. This is user-mutable. This will be same as the termId, if not specified.
required: false
- name: 'description'
type: String
description: |
The user-mutable description of the GlossaryTerm.
required: false
- name: 'labels'
type: KeyValueLabels
description: |
User-defined labels for the GlossaryTerm.
required: false
- name: 'uid'
type: String
description: |
System generated unique id for the GlossaryTerm. This ID will be different if the GlossaryTerm is deleted and re-created with the same name.
output: true
- name: 'createTime'
type: Timestamp
description: |
The time at which the GlossaryTerm was created.
output: true
- name: 'updateTime'
type: Timestamp
description: |
The time at which the GlossaryTerm was last updated.
output: true
- name: 'parent'
type: String
description: |
The immediate parent of the GlossaryTerm in the resource-hierarchy. It can either be a Glossary or a Term. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} OR projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/terms/{termId}
required: true
11 changes: 11 additions & 0 deletions mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
glossary_id = "tf-test-glossary%{random_suffix}"
location = "us-central1"
}

resource "google_dataplex_category" "{{$.PrimaryResourceId}}" {
parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}"
glossary_id = google_dataplex_glossary.category_test_id.glossary_id
location = "us-central1"
category_id = "tf-test-category-basic%{random_suffix}"
}
15 changes: 15 additions & 0 deletions mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
glossary_id = "tf-test-glossary%{random_suffix}"
location = "us-central1"
}

resource "google_dataplex_category" "{{$.PrimaryResourceId}}" {
parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}"
glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id
location = "us-central1"
category_id = "tf-test-category-full%{random_suffix}"

labels = { "tag": "test-tf" }
display_name = "terraform category"
description = "category created by Terraform"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
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"
}
11 changes: 11 additions & 0 deletions mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
glossary_id = "tf-test-glossary%{random_suffix}"
location = "us-central1"
}

resource "google_dataplex_term" "{{$.PrimaryResourceId}}" {
parent = "projects/${google_dataplex_glossary.term_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id.glossary_id}"
glossary_id = google_dataplex_glossary.term_test_id.glossary_id
location = "us-central1"
term_id = "tf-test-term-basic%{random_suffix}"
}
15 changes: 15 additions & 0 deletions mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" {
glossary_id = "tf-test-glossary%{random_suffix}"
location = "us-central1"
}

resource "google_dataplex_term" "{{$.PrimaryResourceId}}" {
parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}"
glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id
location = "us-central1"
term_id = "tf-test-term-full%{random_suffix}"

labels = { "tag": "test-tf" }
display_name = "terraform term"
description = "term created by Terraform"
}
Loading
Loading