Skip to content

Commit f5c10fa

Browse files
committed
Add Dataproc Metastore Database Resource for IAM support
Fixes hashicorp/terraform-provider-google#21822
1 parent 9156ea5 commit f5c10fa

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

mmv1/products/metastore/Database.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
---
14+
name: 'Database'
15+
description: |
16+
Only used to generate IAM resources
17+
# This resource is only used to generate IAM resources. They do not correspond to real
18+
# GCP resources, and should not be used to generate anything other than IAM support.
19+
docs:
20+
base_url: 'projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{name}}'
21+
self_link: 'projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{name}}'
22+
exclude_resource: true
23+
timeouts:
24+
insert_minutes: 2
25+
update_minutes: 2
26+
delete_minutes: 2
27+
iam_policy:
28+
method_name_separator: ':'
29+
parent_resource_attribute: 'database'
30+
parent_resource_type: "google_dataproc_metastore_service"
31+
example_config_body: "templates/terraform/iam/example_config_body/dataproc_metastore_database_template.tf.tmpl"
32+
import_format:
33+
- '{{name}}'
34+
- 'projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{name}}'
35+
custom_code:
36+
examples:
37+
- name: 'dataproc_metastore_service_basic'
38+
primary_resource_id: 'service'
39+
primary_resource_name: 'fmt.Sprintf("tf-test-metastore-srv%s", context["random_suffix"])'
40+
test_vars_overrides:
41+
database: '"default"'
42+
service_resource: '"service"'
43+
vars:
44+
metastore_service_name: 'service-id'
45+
# - name: 'dataproc_metastore_service_database_iam'
46+
# primary_resource_id: 'default'
47+
# primary_resource_name: 'fmt.Sprintf("tf-test-metastore-srv%s", context["random_suffix"])'
48+
# test_env_vars:
49+
# database: "default"
50+
# vars:
51+
# metastore_service_name: 'my-service'
52+
# account_id: 'my-account'
53+
# database: 'default'
54+
parameters:
55+
properties:
56+
- name: 'name'
57+
type: String
58+
description: Dummy property.
59+
required: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "google_dataproc_metastore_service" "{{$.PrimaryResourceId}}" {
2+
service_id = "{{index $.Vars "metastore_service_name"}}"
3+
location = "us-central1"
4+
5+
tier = "DEVELOPER"
6+
}
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
project = google_dataproc_metastore_service.%{service_resource}.project
3+
location = google_dataproc_metastore_service.%{service_resource}.location
4+
service_id = google_dataproc_metastore_service.%{service_resource}.service_id
5+
database = "%{database}"

0 commit comments

Comments
 (0)