diff --git a/docs/content/best-practices/common-resource-patterns.md b/docs/content/best-practices/common-resource-patterns.md index 8b3950dff6c1..9cdc5e9f7f7d 100644 --- a/docs/content/best-practices/common-resource-patterns.md +++ b/docs/content/best-practices/common-resource-patterns.md @@ -11,7 +11,7 @@ Singletons are resources – often config or settings objects – that can only Implementing resources like this may require some or all of the following: -1. If there _isn't_ a create endpoint, set the [create_url]({{< ref "/develop/resource-reference/#create_url" >}}) to point to the update endpoint. +1. If there _isn't_ a create endpoint, set the [create_url]({{< ref "/reference/resource-reference/#create_url" >}}) to point to the update endpoint. 1. If there _is_ a create endpoint, add [pre-create custom code]({{< ref "/develop/custom-code/#pre_post_injection" >}}) that implements "acquire-on-create" logic. The custom code should check whether the resource already exists with a read request, and if it does, run the update logic and return early. For example, see [mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl](https://github.com/GoogleCloudPlatform/magic-modules/blob/dc4d9755cb9288177e0996c1c3b3fa9738ebdf89/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl). * Note: The main disadvantage of "acquire-on-create" logic is that users will not be presented with a diff between the resource's old and new states – because from the terraform perspective, the resource is only being created. Please upvote https://github.com/hashicorp/terraform/issues/19017 to request better support for this workflow. -1. If there is no delete endpoint, set [`exclude_delete: true`]({{< ref "/develop/resource-reference/#create_url" >}}) at the top level of the resource. \ No newline at end of file +1. If there is no delete endpoint, set [`exclude_delete: true`]({{< ref "/reference/resource-reference/#create_url" >}}) at the top level of the resource. \ No newline at end of file diff --git a/docs/content/best-practices/deletion-behaviors.md b/docs/content/best-practices/deletion-behaviors.md index 433010cc7ee0..bb97ffdf64d8 100644 --- a/docs/content/best-practices/deletion-behaviors.md +++ b/docs/content/best-practices/deletion-behaviors.md @@ -40,4 +40,4 @@ See [Client-side fields]({{< ref "/develop/client-side-fields" >}}) for informat ## Exclude deletion {#exclude_delete} -Some resources do not support deletion in the API and can only be removed from state. For these resources, the best practice is to set [`exclude_delete: true`]({{< ref "/develop/resource-reference#exclude_delete" >}}) on the resource. +Some resources do not support deletion in the API and can only be removed from state. For these resources, the best practice is to set [`exclude_delete: true`]({{< ref "/reference/resource-reference#exclude_delete" >}}) on the resource. diff --git a/docs/content/develop/add-fields.md b/docs/content/develop/add-fields.md index 0e3234ffbdc9..12d0642982fd 100644 --- a/docs/content/develop/add-fields.md +++ b/docs/content/develop/add-fields.md @@ -186,7 +186,7 @@ For `key_name` and `key_description`, provide a domain-appropriate name and desc 2. Modify the field configuration according to the API documentation and behavior. -> **Note:** The templates in this section only include the most commonly-used fields. For a comprehensive reference, see [MMv1 field reference]({{}}). For information about modifying the values sent and received for a field, see [Modify the API request or response]({{}}). +> **Note:** The templates in this section only include the most commonly-used fields. For a comprehensive reference, see [MMv1 field reference]({{}}). For information about modifying the values sent and received for a field, see [Modify the API request or response]({{}}). {{< /tab >}} {{< tab "Handwritten" >}} 1. Add the field to the handwritten resource's schema. diff --git a/docs/content/develop/add-iam-support.md b/docs/content/develop/add-iam-support.md index 8b39abe7d88d..b0d4339d4d12 100644 --- a/docs/content/develop/add-iam-support.md +++ b/docs/content/develop/add-iam-support.md @@ -60,7 +60,7 @@ iam_policy: # min_version: beta ``` -2. Modify the template as needed to match the API resource's documented behavior. These are the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference: `iam_policy` ↗]({{}}). +2. Modify the template as needed to match the API resource's documented behavior. These are the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference: `iam_policy` ↗]({{}}). 3. Delete all remaining comments in the IAM configuration (including attribute descriptions) that were copied from the above template. {{< /tab >}} {{< tab "Handwritten" >}} diff --git a/docs/content/develop/add-resource.md b/docs/content/develop/add-resource.md index cfc03f132c33..4b7ce9702800 100644 --- a/docs/content/develop/add-resource.md +++ b/docs/content/develop/add-resource.md @@ -146,7 +146,7 @@ For more information about types of resources and the generation process overall 3. Modify the template as needed to match the API resource's documented behavior. 4. Delete all remaining comments in the resource configuration (including attribute descriptions) that were copied from the above template. -> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference ↗]({{}}). +> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference ↗]({{}}). {{< /tab >}} {{< tab "Handwritten" >}} > **Warning:** Handwritten resources are more difficult to develop and maintain. New handwritten resources will only be accepted if implementing the resource in MMv1 would require entirely overriding two or more CRUD methods. diff --git a/docs/content/develop/custom-code.md b/docs/content/develop/custom-code.md index 5e9254efd8d4..52a62cae5acd 100644 --- a/docs/content/develop/custom-code.md +++ b/docs/content/develop/custom-code.md @@ -32,8 +32,8 @@ Use `custom_code.constants` to inject top-level code in a resource file. This is - Constants - Regexes compiled at build time -- Functions, such as [diff suppress functions]({{}}), - [validation functions]({{}}), +- Functions, such as [diff suppress functions]({{}}), + [validation functions]({{}}), CustomizeDiff functions, and so on. - Methods diff --git a/docs/content/develop/diffs.md b/docs/content/develop/diffs.md index 4707f10bb40e..1248ab0baf64 100644 --- a/docs/content/develop/diffs.md +++ b/docs/content/develop/diffs.md @@ -176,7 +176,7 @@ See [SDKv2 Schema Behaviors - DiffSuppressFunc ↗](https://developer.hashicorp. ## API field that is never included in the response {#ignore_read} -This is common for fields that store credentials or similar information. Such fields should also be marked as [`sensitive`]({{< ref "/develop/field-reference#sensitive" >}}). +This is common for fields that store credentials or similar information. Such fields should also be marked as [`sensitive`]({{< ref "/reference/field-reference#sensitive" >}}). In the flattener for the field, return the value of the field in the user's configuration. diff --git a/docs/content/develop/field-reference.md b/docs/content/reference/field-reference.md similarity index 98% rename from docs/content/develop/field-reference.md rename to docs/content/reference/field-reference.md index 313d1335280d..36e61f3e243f 100644 --- a/docs/content/develop/field-reference.md +++ b/docs/content/reference/field-reference.md @@ -1,8 +1,9 @@ --- title: "MMv1 field reference" -weight: 120 +weight: 20 aliases: - /reference/field-reference + - /develop/field-reference --- # MMv1 field reference @@ -280,7 +281,7 @@ This property has two mutually exclusive child properties: [`function: verify.ValidateRegexp(REGEX_STRING)`](https://github.com/hashicorp/terraform-provider-google-beta/blob/0ef51142a4dd1c1a4fc308c1eb09dce307ebe5f5/google-beta/verify/validation.go#L425). `validation` is not supported for Array fields (including sets); however, individual -elements in the array can be validated using [`item_validation`]({{}}). +elements in the array can be validated using [`item_validation`]({{}}). Example: Provider-specific function @@ -331,7 +332,7 @@ stating the current allowed values in the String field's description. Do not include UNSPECIFIED values in this list. Enums will validate that the provided field is in the allowed list unless a -custom [`validation`]({{}}) is provided. +custom [`validation`]({{}}) is provided. Example: @@ -380,7 +381,7 @@ item_type: ### `item_validation` Array only. Controls the [`ValidateFunc`](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#validatefunc) -used to validate individual items in the array. Behaves like [`validation`]({{}}). +used to validate individual items in the array. Behaves like [`validation`]({{}}). For arrays of enums, this will override the default validation (that the provided value is one of the enum [`values`](#values)). If you need additional validation on top of an enum, ensure that the supplied validation func also verifies the enum diff --git a/docs/content/reference/make-commands.md b/docs/content/reference/make-commands.md index cc35715feb8a..6742b44173a8 100644 --- a/docs/content/reference/make-commands.md +++ b/docs/content/reference/make-commands.md @@ -1,6 +1,6 @@ --- title: "make commands" -weight: 10 +weight: 30 --- # `make` commands reference diff --git a/docs/content/develop/resource-reference.md b/docs/content/reference/resource-reference.md similarity index 97% rename from docs/content/develop/resource-reference.md rename to docs/content/reference/resource-reference.md index 3ca0dbad4081..73aec50bd3d8 100644 --- a/docs/content/develop/resource-reference.md +++ b/docs/content/reference/resource-reference.md @@ -1,9 +1,10 @@ --- title: "MMv1 resource reference" -weight: 130 +weight: 10 aliases: - /reference/resource-reference - /reference/iam-policy-reference + - /develop/resource-reference --- # MMv1 resource reference @@ -334,12 +335,12 @@ the behavior of a Terraform resource such as `deletion_protection`. ### `parameters` -Contains a list of [fields]({{< ref "/develop/field-reference" >}}). By convention, +Contains a list of [fields]({{< ref "/reference/field-reference" >}}). By convention, these should be the fields that are part URL parameters such as `location` and `name`. ### `properties` -Contains a list of [fields]({{< ref "/develop/field-reference" >}}). By convention, +Contains a list of [fields]({{< ref "/reference/field-reference" >}}). By convention, these should be fields that aren't part of the URL parameters. Example: diff --git a/docs/content/reference/ruby-go-changes.md b/docs/content/reference/ruby-go-changes.md index ee4f8070f0bd..eac38ea6c090 100644 --- a/docs/content/reference/ruby-go-changes.md +++ b/docs/content/reference/ruby-go-changes.md @@ -1,6 +1,6 @@ --- title: "Ruby to Go Migration" -weight: 10 +weight: 40 --- # What has changed in the MMv1 Go migration diff --git a/docs/content/test/test.md b/docs/content/test/test.md index fe83cb47088c..47a2ebe04273 100644 --- a/docs/content/test/test.md +++ b/docs/content/test/test.md @@ -241,8 +241,8 @@ An update test is a test that creates the target resource and then makes updates ## Add unit tests A unit test verifies functionality that is not related to interactions with the API, such as -[diff suppress functions]({{}}), -[validation functions]({{}}), +[diff suppress functions]({{}}), +[validation functions]({{}}), CustomizeDiff functions, and so on. Unit tests should be added to the appropriate folder in [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) in the file called `resource_PRODUCT_RESOURCE_test.go`. (You may need to create this file if it does not already exist. Replace PRODUCT with the product name and RESOURCE with the resource name; it should match the name of the generated resource file.)