Skip to content

Commit

Permalink
Add contributor documentation for resource metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
roaks3 committed Dec 19, 2024
1 parent 37e4abb commit adb6e12
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/content/develop/add-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 32 additions & 0 deletions docs/content/reference/metadata.md
Original file line number Diff line number Diff line change
@@ -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".
4 changes: 4 additions & 0 deletions mmv1/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"-"`
Expand Down

0 comments on commit adb6e12

Please sign in to comment.