From adb6e12f7bbdb47335ce46e61eb36a578e566b8e Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Thu, 19 Dec 2024 13:07:59 -0500 Subject: [PATCH 1/2] Add contributor documentation for resource metadata --- docs/content/develop/add-resource.md | 1 + docs/content/reference/metadata.md | 32 ++++++++++++++++++++++++++++ mmv1/api/resource.go | 4 ++++ 3 files changed, 37 insertions(+) create mode 100644 docs/content/reference/metadata.md diff --git a/docs/content/develop/add-resource.md b/docs/content/develop/add-resource.md index db6cd2c1993d..1a50218d3808 100644 --- a/docs/content/develop/add-resource.md +++ b/docs/content/develop/add-resource.md @@ -158,6 +158,7 @@ For more information about types of resources and the generation process overall - Documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) - Tests: Copy to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services), and remove `_generated` from the filename - Sweepers: Put to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services), and add `_sweeper` suffix to the filename + - Metadata: Copy `*_meta.yaml` to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services), and remove `_generated` from the filename 4. Modify the Go code as needed. - Replace all occurrences of `github.com/hashicorp/terraform-provider-google-beta/google-beta` with `github.com/hashicorp/terraform-provider-google/google` - Remove the `Example` suffix from all test function names. diff --git a/docs/content/reference/metadata.md b/docs/content/reference/metadata.md new file mode 100644 index 000000000000..0bd906047632 --- /dev/null +++ b/docs/content/reference/metadata.md @@ -0,0 +1,32 @@ +--- +title: "MMv1 metadata reference" +weight: 35 +--- + +# MMv1 metadata reference + +This page documents all properties for metadata. + +## Required + +### `resource` + +The name of the Terraform resource e.g., "google_cloudfunctions2_function". + +### `generation_type` + +The generation method used to create the Terraform resource e.g., "mmv1", "dcl", "handwritten". + +## Optional + +### `api_service_name` + +The base name of the API used for this resource e.g., "cloudfunctions.googleapis.com". + +### `api_version` + +The version of the API used for this resource e.g., "v2". + +### `api_resource_type_kind` + +The API "resource type kind" used for this resource e.g., "Function". diff --git a/mmv1/api/resource.go b/mmv1/api/resource.go index 3edcd10210c1..0599004861d2 100644 --- a/mmv1/api/resource.go +++ b/mmv1/api/resource.go @@ -331,6 +331,10 @@ type Resource struct { // The compiler to generate the downstream files, for example "terraformgoogleconversion-codegen". Compiler string `yaml:"-"` + // The API "resource type kind" used for this resource e.g., "Function". + // If this is not set, then :name is used instead, which is strongly + // preferred wherever possible. Its main purpose is for supporting + // fine-grained resources and legacy resources. ApiResourceTypeKind string `yaml:"api_resource_type_kind,omitempty"` ImportPath string `yaml:"-"` From b4211adf5c95bd8001697c4a157320cc31ab39a6 Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Thu, 19 Dec 2024 17:28:52 -0500 Subject: [PATCH 2/2] Clarify purpose of metadata --- docs/content/reference/metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/reference/metadata.md b/docs/content/reference/metadata.md index 0bd906047632..5b5e0cd7ae50 100644 --- a/docs/content/reference/metadata.md +++ b/docs/content/reference/metadata.md @@ -5,7 +5,7 @@ weight: 35 # MMv1 metadata reference -This page documents all properties for metadata. +This page documents all properties for metadata. Metadata does not impact the provider itself, but is used by Google internally for coverage metrics. ## Required