<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Overview on Magic Modules</title><link>https://googlecloudplatform.github.io/magic-modules/</link><description>Recent content in Overview on Magic Modules</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://googlecloudplatform.github.io/magic-modules/index.xml" rel="self" type="application/rss+xml"/><item><title>Add documentation</title><link>https://googlecloudplatform.github.io/magic-modules/document/add-documentation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/document/add-documentation/</guid><description>&lt;h1 id="add-documentation"&gt;Add documentation&lt;a class="anchor" href="#add-documentation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Documentation is autogenerated based on the &lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/add-resource/"&gt;resource&lt;/a&gt; and [field(https://googlecloudplatform.github.io/magic-modules/develop/add-fields/] configurations. This page describes how to add documentation to resources and fields.&lt;/p&gt;
&lt;p&gt;For more information about types of resources and the generation process overall, see &lt;a href="https://googlecloudplatform.github.io/magic-modules/"&gt;How Magic Modules works&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Complete the steps in &lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt; to set up your environment and your Google Cloud project.&lt;/li&gt;
&lt;li&gt;Ensure that your &lt;code&gt;magic-modules&lt;/code&gt;, &lt;code&gt;terraform-provider-google&lt;/code&gt;, and &lt;code&gt;terraform-provider-google-beta&lt;/code&gt; repositories are up to date.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; ~/magic-modules
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google-beta
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="add-documentation-1"&gt;Add documentation&lt;a class="anchor" href="#add-documentation-1"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-docs" id="tabs-docs-0" checked="checked" /&gt;&lt;label for="tabs-docs-0"&gt;MMv1&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;p&gt;To preview the documentation:&lt;/p&gt;</description></item><item><title>Add resource tests</title><link>https://googlecloudplatform.github.io/magic-modules/test/test/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/test/test/</guid><description>&lt;h1 id="add-resource-tests"&gt;Add resource tests&lt;a class="anchor" href="#add-resource-tests"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page describes how to add tests to a new resource in the &lt;code&gt;google&lt;/code&gt; or &lt;code&gt;google-beta&lt;/code&gt; Terraform provider.&lt;/p&gt;
&lt;p&gt;The providers have two basic types of tests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unit tests: test specific functions thoroughly. Unit tests do not interact with GCP APIs.&lt;/li&gt;
&lt;li&gt;Acceptance tests (aka VCR tests, or create and update tests): test that resources interact as expected with the APIs. Acceptance tests interact with GCP APIs, but should only test the provider&amp;rsquo;s behavior in constructing the API requests and parsing the responses.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Acceptance tests are also called &amp;ldquo;VCR tests&amp;rdquo; because they use &lt;a href="https://github.com/dnaeon/go-vcr"&gt;&lt;code&gt;go-vcr&lt;/code&gt;&lt;/a&gt; to record and play back HTTP requests. This allows tests to run more quickly on PRs because the resources don&amp;rsquo;t actually need to be created, updated, or destroyed by the live API.&lt;/p&gt;</description></item><item><title>Create a pull request</title><link>https://googlecloudplatform.github.io/magic-modules/code-review/create-pr/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/code-review/create-pr/</guid><description>&lt;h1 id="create-a-pull-request-pr"&gt;Create a pull request (PR)&lt;a class="anchor" href="#create-a-pull-request-pr"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="requirements"&gt;Requirements&lt;a class="anchor" href="#requirements"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Make sure your &lt;a href="https://docs.github.com/en/get-started/quickstart/github-flow#create-a-branch"&gt;branch&lt;/a&gt; contains a single self-contained change. For example:
&lt;ul&gt;
&lt;li&gt;If you are adding multiple resources to the provider, only put one resource in each PR - even if the product requires all resources to be present before it can be meaningfully used.&lt;/li&gt;
&lt;li&gt;If you are adding a few fields and also fixing a bug, create one PR for adding the new fields and a separate PR for the bugs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Follow the instructions at &lt;a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request"&gt;Creating a pull request&lt;/a&gt; to create a pull request to merge your branch into &lt;code&gt;GoogleCloudPlatform/magic-modules&lt;/code&gt;.
&lt;ul&gt;
&lt;li&gt;Make sure the PR body includes the text &lt;code&gt;Fixes GITHUB_ISSUE_LINK.&lt;/code&gt; once per issue resolved by your PR. Replace &lt;code&gt;GITHUB_ISSUE_LINK&lt;/code&gt; with a link to a GitHub issue from the &lt;a href="https://github.com/hashicorp/terraform-provider-google/issues"&gt;provider issue tracker&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/code-review/release-notes/"&gt;Write release notes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="code-review"&gt;Code review&lt;a class="anchor" href="#code-review"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;(For Google-driven changes) Assign a service team engineer to review your change. Get their approval before proceeding with review by maintainers.&lt;/li&gt;
&lt;li&gt;Creating a new pull request or pushing a new commit automatically triggers our CI pipelines and workflows. After CI starts, downstream diff generation takes about 10 minutes; &lt;a href="https://googlecloudplatform.github.io/magic-modules/test/test/"&gt;VCR tests&lt;/a&gt; can take up to 2 hours. If you are a community contributor, some tests will only run after approval from a reviewer.
&lt;ul&gt;
&lt;li&gt;While convenient, relying on CI to test iterative changes to PRs often adds extreme latency to reviews if there are errors in test configurations or at runtime. We &lt;strong&gt;strongly&lt;/strong&gt; recommend you &lt;a href="https://googlecloudplatform.github.io/magic-modules/test/run-tests/"&gt;test your changes locally before pushing&lt;/a&gt; even after the initial change.&lt;/li&gt;
&lt;li&gt;VCR tests will first attempt to play back recorded HTTP requests (REPLAYING mode). If any tests fail, they will run in RECORDING mode to generate a new cassette; then, the same tests will run again in REPLAYING mode to detect any nondeterministic behavior in the test (which can cause flaky tests.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A maintainer will automatically be assigned to your PR for final review.&lt;/li&gt;
&lt;li&gt;If your assigned reviewer does not respond to changes on a pull request within two US business days, ping them on the pull request.&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;&lt;strong&gt;TIP:&lt;/strong&gt; Speeding up review:&lt;/p&gt;</description></item><item><title>Immutable fields</title><link>https://googlecloudplatform.github.io/magic-modules/best-practices/immutable-fields/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/best-practices/immutable-fields/</guid><description>&lt;h1 id="immutable-fields"&gt;Immutable fields&lt;a class="anchor" href="#immutable-fields"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href="https://developer.hashicorp.com/terraform/intro#how-does-terraform-work"&gt;&lt;code&gt;ForceNew&lt;/code&gt;&lt;/a&gt; in a Terraform resource schema attribute that indicates that a field is immutable – that is, that a change to the field requires the resource to be destroyed and recreated.&lt;/p&gt;</description></item><item><title>MMv1 resource reference</title><link>https://googlecloudplatform.github.io/magic-modules/reference/resource/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/resource/</guid><description>&lt;h1 id="mmv1-resource-reference"&gt;MMv1 resource reference&lt;a class="anchor" href="#mmv1-resource-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page documents commonly-used properties for resources. For a full list of
available properties, see &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/resource.go"&gt;resource.go ↗&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="basic"&gt;Basic&lt;a class="anchor" href="#basic"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="name"&gt;&lt;code&gt;name&lt;/code&gt;&lt;a class="anchor" href="#name"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;API resource name.&lt;/p&gt;
&lt;h3 id="description"&gt;&lt;code&gt;description&lt;/code&gt;&lt;a class="anchor" href="#description"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Resource description. Used in documentation.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff6ac1"&gt;description&lt;/span&gt;: |&lt;span style="color:#5af78e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; This is a multi-line description
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; of a resource. All multi-line descriptions must follow
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; this format of using a vertical bar followed by a line-break,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; with the remaining description being indented.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="references"&gt;&lt;code&gt;references&lt;/code&gt;&lt;a class="anchor" href="#references"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Links to reference documentation for a resource. Contains two attributes:&lt;/p&gt;</description></item><item><title>Set up your development environment</title><link>https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/</guid><description>&lt;h1 id="set-up-your-development-environment"&gt;Set up your development environment&lt;a class="anchor" href="#set-up-your-development-environment"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Before you start adding or updating a Terraform resource using
&lt;a href="https://googlecloudplatform.github.io/magic-modules/"&gt;magic-modules&lt;/a&gt;, you must first set up your environment by
installing the necessary tools. This page explains the steps for setting up your
development environment.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://cloud.google.com/sdk/docs/install"&gt;Install the gcloud CLI.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the Google Cloud console, on the project selector page, select or
&lt;a href="https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects"&gt;create a Google Cloud project&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you don&amp;rsquo;t already have a project to use for testing changes to
the Terraform providers, create a project instead of selecting an existing
poject. After you finish these steps, you can delete the project, removing
all resources associated with the project.&lt;/p&gt;</description></item><item><title>Types of breaking changes</title><link>https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/breaking-changes/breaking-changes/</guid><description>&lt;h1 id="types-of-breaking-changes"&gt;Types of breaking changes&lt;a class="anchor" href="#types-of-breaking-changes"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A &amp;ldquo;breaking change&amp;rdquo; is any change that requires an end user to modify a
previously-valid configuration after a provider upgrade. In this context,
a &amp;ldquo;valid configuration&amp;rdquo; is one that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is considered syntactically correct by &lt;code&gt;terraform validate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Does not return an error during &lt;code&gt;terraform apply&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Creates, updates, deletes, or does not modify resources&lt;/li&gt;
&lt;li&gt;Only manages resources that have not been altered with other tools,
such as &lt;code&gt;gcloud&lt;/code&gt; or Cloud Console.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This document lists many types of breaking changes but may not be entirely
comprehensive. Some types of changes that would normally be &amp;ldquo;breaking&amp;rdquo; may
have specific mitigating circumstances that make them non-breaking.&lt;/p&gt;</description></item><item><title>Add a resource</title><link>https://googlecloudplatform.github.io/magic-modules/develop/add-resource/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/add-resource/</guid><description>&lt;h1 id="add-a-resource"&gt;Add a resource&lt;a class="anchor" href="#add-a-resource"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page describes how to add a new resource to the &lt;code&gt;google&lt;/code&gt; or &lt;code&gt;google-beta&lt;/code&gt; Terraform provider using MMv1 and/or handwritten code.&lt;/p&gt;
&lt;p&gt;For more information about types of resources and the generation process overall, see &lt;a href="https://googlecloudplatform.github.io/magic-modules/"&gt;How Magic Modules works&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Complete the steps in &lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt; to set up your environment and your Google Cloud project.&lt;/li&gt;
&lt;li&gt;Ensure that your &lt;code&gt;magic-modules&lt;/code&gt;, &lt;code&gt;terraform-provider-google&lt;/code&gt;, and &lt;code&gt;terraform-provider-google-beta&lt;/code&gt; repositories are up to date.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; ~/magic-modules
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google-beta
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="add-a-resource-1"&gt;Add a resource&lt;a class="anchor" href="#add-a-resource-1"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-resource" id="tabs-resource-0" checked="checked" /&gt;&lt;label for="tabs-resource-0"&gt;MMv1&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Using an editor of your choice, in the appropriate &lt;a href="https://googlecloudplatform.github.io/magic-modules/#mmv1"&gt;product folder&lt;/a&gt;, create a file called &lt;code&gt;RESOURCE_NAME.yaml&lt;/code&gt;. Replace &lt;code&gt;RESOURCE_NAME&lt;/code&gt; with the name of the API resource you are adding support for. For example, a configuration file for &lt;a href="https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.natAddresses"&gt;NatAddress&lt;/a&gt; would be called &lt;code&gt;NatAddress.yaml&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Add TGC conversion</title><link>https://googlecloudplatform.github.io/magic-modules/convert/add-new-resource-tgc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/convert/add-new-resource-tgc/</guid><description>&lt;h1 id="add-tgc-conversion"&gt;Add TGC conversion&lt;a class="anchor" href="#add-tgc-conversion"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class="book-hint warning"&gt;

This method of adding TGC support is currently experimental and not officially supported. We recommended this path only for core contributors.
&lt;/blockquote&gt;
&lt;p&gt;terraform-google-conversion (TGC) consumes a Terraform plan and uses it to build Cloud Asset Inventory (CAI) Assets. These built assets only exist in memory locally.&lt;/p&gt;
&lt;p&gt;TGC supports only those GCP resources that are available in both the Terraform provider and Cloud Asset Inventory.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="getting-a-terraform-resource-name-from-a-gcp-resource-name"&gt;Getting a Terraform resource name from a GCP resource name&lt;a class="anchor" href="#getting-a-terraform-resource-name-from-a-gcp-resource-name"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The first step in determining if a GCP resource is supported is to identify the corresponding Terraform resource. You can often do this by searching for the GCP resource name in the &lt;a href="https://registry.terraform.io/providers/hashicorp/google/latest/docs"&gt;Terraform google provider documentation&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Contribution process</title><link>https://googlecloudplatform.github.io/magic-modules/contribution-process/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/contribution-process/</guid><description>&lt;h1 id="contribution-process"&gt;Contribution process&lt;a class="anchor" href="#contribution-process"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page explains how you can contribute code and documentation to the	&lt;code&gt;magic-modules&lt;/code&gt; repository.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Familiarize yourself with &lt;a href="https://docs.github.com/en/get-started/quickstart/github-flow"&gt;GitHub flow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/get-started/quickstart/fork-a-repo"&gt;Fork&lt;/a&gt; the &lt;code&gt;Magic Modules&lt;/code&gt; repository into your GitHub account&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Check whether the feature you want to work on has already been &lt;a href="https://github.com/hashicorp/terraform-provider-google/issues"&gt;requested in the issue tracker&lt;/a&gt;.
&lt;ul&gt;
&lt;li&gt;If there&amp;rsquo;s an issue and it already has a dedicated assignee, this indicates that someone might have already started to work on a solution. Otherwise, you&amp;rsquo;re welcome to work on the issue.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="contribute-code"&gt;Contribute code&lt;a class="anchor" href="#contribute-code"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/get-started/quickstart/github-flow#create-a-branch"&gt;Create a new branch for your change&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Make the code change. For example:
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/add-resource/"&gt;Add a resource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/test/test/"&gt;Add resource tests&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/add-handwritten-datasource/"&gt;Add a datasource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/promote-to-ga/"&gt;Promote to GA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/breaking-changes/make-a-breaking-change/"&gt;Make a breaking change&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/generate-providers/"&gt;Generate the providers&lt;/a&gt; that include your change.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/test/run-tests/"&gt;Run provider tests locally&lt;/a&gt; that are relevant to the change you made&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/code-review/create-pr/"&gt;Create a pull request (PR)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;(For Google-driven changes) Do a &lt;a href="https://googlecloudplatform.github.io/magic-modules/code-review/review-pr/"&gt;local review&lt;/a&gt; with a service team engineer&lt;/li&gt;
&lt;li&gt;Make changes in response to maintainers&amp;rsquo; &lt;a href="https://googlecloudplatform.github.io/magic-modules/code-review/create-pr/#code-review"&gt;code review&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="after-your-change-is-merged"&gt;After your change is merged&lt;a class="anchor" href="#after-your-change-is-merged"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After your change is merged, it can take a week or longer to be released to customers.&lt;/p&gt;</description></item><item><title>Deletion policy</title><link>https://googlecloudplatform.github.io/magic-modules/best-practices/deletion-policy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/best-practices/deletion-policy/</guid><description>&lt;h1 id="deletion-policy"&gt;Deletion policy&lt;a class="anchor" href="#deletion-policy"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page documents how to work with the &lt;code&gt;deletion_policy&lt;/code&gt; field present in nearly all provider resources.&lt;/p&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-schema" id="tabs-schema-0" checked="checked" /&gt;&lt;label for="tabs-schema-0"&gt;MMv1&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;p&gt;MMv1 resources support &lt;code&gt;deletion_policy&lt;/code&gt; out of the box without any complication or changes needed by a contributor.&lt;/p&gt;
&lt;p&gt;There are three values allowed on every &lt;code&gt;deletion_policy&lt;/code&gt; field:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PREVENT&lt;/code&gt;: This will block deletion of the resource.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ABANDON&lt;/code&gt;: Deletion of the resource will remove it from Terraform state but not from the API.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DELETE&lt;/code&gt;: Deletion of the resource will remove it from Terraform state and from the API.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="updating-the-default-value-of-deletion_policy-for-a-resource"&gt;Updating the default value of &lt;code&gt;deletion_policy&lt;/code&gt; for a resource&lt;a class="anchor" href="#updating-the-default-value-of-deletion_policy-for-a-resource"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;All resources will use a value of &amp;ldquo;DELETE&amp;rdquo; by default if unspecified, but this default can be changed to another value by including the following:&lt;/p&gt;</description></item><item><title>Handwritten docs style guide</title><link>https://googlecloudplatform.github.io/magic-modules/document/handwritten-docs-style-guide/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/document/handwritten-docs-style-guide/</guid><description>&lt;h1 id="handwritten-documentation-style-guide"&gt;Handwritten documentation style guide&lt;a class="anchor" href="#handwritten-documentation-style-guide"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This document describes the style guide for handwritten documentation for resources and data sources. MMv1-based resources will automatically generate documentation that matches this style guide.&lt;/p&gt;
&lt;h2 id="file-name-and-location"&gt;File name and location&lt;a class="anchor" href="#file-name-and-location"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Handwritten documentation lives in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data sources: &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/d"&gt;&lt;code&gt;magic-modules/third_party/terraform/website/docs/d/&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Resources: &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r"&gt;&lt;code&gt;magic-modules/third_party/terraform/website/docs/r/&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The name of the file is the name of the resource without a &lt;code&gt;google_&lt;/code&gt; prefix. For example, for &lt;code&gt;google_compute_instance&lt;/code&gt;, the file is called &lt;code&gt;compute_instance.html.markdown&lt;/code&gt;&lt;/p&gt;
&lt;h2 id="yaml-frontmatter"&gt;YAML frontmatter&lt;a class="anchor" href="#yaml-frontmatter"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Every resource or datasource documentation page must include YAML frontmatter which sets &lt;code&gt;subcategory&lt;/code&gt; (where the page will be displayed in the left sidebar).&lt;/p&gt;</description></item><item><title>Make a breaking change</title><link>https://googlecloudplatform.github.io/magic-modules/breaking-changes/make-a-breaking-change/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/breaking-changes/make-a-breaking-change/</guid><description>Guidance on making a breaking changes</description></item><item><title>MMv1 field reference</title><link>https://googlecloudplatform.github.io/magic-modules/reference/field/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/field/</guid><description>&lt;h1 id="mmv1-field-reference"&gt;MMv1 field reference&lt;a class="anchor" href="#mmv1-field-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page documents commonly-used properties for fields. For a full list of
available properties, see &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/api/type.go"&gt;type.go ↗&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="shared-properties"&gt;Shared properties&lt;a class="anchor" href="#shared-properties"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="name"&gt;&lt;code&gt;name&lt;/code&gt;&lt;a class="anchor" href="#name"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Specifies the name of the field within Terraform. By default this will also
be the key for the field in the API request message, if a separate &lt;code&gt;api_name&lt;/code&gt;
is not declared using the corresponding property.&lt;/p&gt;
&lt;h3 id="type"&gt;&lt;code&gt;type&lt;/code&gt;&lt;a class="anchor" href="#type"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sets the expected data type of the field. All valid types are declared &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/d7777055cb7618648725abd16d3b05e5c138fc56/mmv1/api/type.go#L673"&gt;here&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Review a pull request</title><link>https://googlecloudplatform.github.io/magic-modules/code-review/review-pr/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/code-review/review-pr/</guid><description>&lt;h1 id="review-a-pull-request"&gt;Review a pull request&lt;a class="anchor" href="#review-a-pull-request"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page provides guidelines for reviewing a Magic Modules pull request (PR).&lt;/p&gt;
&lt;p&gt;Google-driven changes must have a service team engineer review changes prior
to review by repository maintainers. For community members, this is not required.&lt;/p&gt;
&lt;h2 id="review"&gt;Review&lt;a class="anchor" href="#review"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Read the PR description to understand the context and ensure the PR either
&lt;ul&gt;
&lt;li&gt;is linked to a GitHub issue or an internal bug
&lt;ul&gt;
&lt;li&gt;if not, check the &lt;a href="https://github.com/hashicorp/terraform-provider-google/issues"&gt;issue tracker&lt;/a&gt; to see whether the feature has already been requested and add the issues in the description, if any.&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Fixes {github_issue_link}&amp;rdquo; is preferred if an external issue is available because it will &lt;a href="https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue"&gt;auto-close the issue&lt;/a&gt; when the PR is merged. However, there&amp;rsquo;s no need to create an external issue solely for this purpose.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;establishes clear context itself via title or description.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If the PR adds any new resource, ensure that the resource does not already exist in the &lt;a href="https://github.com/hashicorp/terraform-provider-google"&gt;GA provider&lt;/a&gt; or &lt;a href="https://github.com/hashicorp/terraform-provider-google-beta"&gt;beta provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Read through all the changes in the PR, generated code in the downstreams and the API documentation to ensure that:
&lt;ol&gt;
&lt;li&gt;the resource schema added in the PR matches the API structure.&lt;/li&gt;
&lt;li&gt;the features are added in the correct version
&lt;ul&gt;
&lt;li&gt;features only available in beta are not included in the GA google provider.&lt;/li&gt;
&lt;li&gt;features added to the GA provider are also included in the beta provider &amp;ndash; beta should be a strict superset of GA.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;no &lt;a href="https://googlecloudplatform.github.io/magic-modules/breaking-changes/make-a-breaking-change/"&gt;breaking changes&lt;/a&gt; are introduced without a valid justification. Add the &lt;code&gt;override-breaking-change&lt;/code&gt; label if there is a valid justification.
&lt;ul&gt;
&lt;li&gt;remember to check for changes in default behaviour like changing the flags on delete!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;verify the change &lt;strong&gt;fully&lt;/strong&gt; resolves the linked issues, if any. If it does not, change the &amp;ldquo;Fixes&amp;rdquo; message to &amp;ldquo;Part of&amp;rdquo;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Check the tests added/modified to ensure that:
&lt;ol&gt;
&lt;li&gt;all fields added/updated in the PR appear in at least one test.
&lt;ul&gt;
&lt;li&gt;It is advisable to test updating from a non-zero value to a zero value if feasible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;all mutable fields are tested in at least one update test.&lt;/li&gt;
&lt;li&gt;all resources in the acceptance tests have a &lt;code&gt;tf-test&lt;/code&gt; or &lt;code&gt;tf_test&lt;/code&gt; prefix in their primary id field.&lt;/li&gt;
&lt;li&gt;all handwritten test Config steps include import steps following them&lt;/li&gt;
&lt;li&gt;all related tests pass in GA for features promoted from beta to GA.
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;Note:
Presubmit VCR tests do not run in GA. Manual testing is required for promoted GA features.&lt;/p&gt;</description></item><item><title>Run tests</title><link>https://googlecloudplatform.github.io/magic-modules/test/run-tests/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/test/run-tests/</guid><description>&lt;h1 id="run-tests"&gt;Run tests&lt;a class="anchor" href="#run-tests"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/generate-providers/"&gt;Generate the modified provider(s)&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Set up application default credentials for Terraform&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gcloud auth application-default login
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;export&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;GOOGLE_USE_DEFAULT_CREDENTIALS&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set the following environment variables:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;export&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;GOOGLE_PROJECT&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;PROJECT_ID
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;export&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;GOOGLE_REGION&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;us-central1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;export&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;GOOGLE_ZONE&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;us-central1-a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace &lt;code&gt;PROJECT_ID&lt;/code&gt; with the ID of the Google Cloud project you are using for testing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Some tests may require additional variables to be set, such as:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;GOOGLE_ORG
GOOGLE_BILLING_ACCOUNT&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="run-automated-tests"&gt;Run automated tests&lt;a class="anchor" href="#run-automated-tests"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-version" id="tabs-version-0" checked="checked" /&gt;&lt;label for="tabs-version-0"&gt;GA Provider&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Run unit tests and linters&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;make &lt;span style="color:#ff5c57"&gt;test&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;make lint&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run acceptance tests for only modified resources. (Full test runs can take over 9 hours.) See &lt;a href="https://pkg.go.dev/cmd/go#hdr-Testing_flags"&gt;Go&amp;rsquo;s documentation&lt;/a&gt; for more information about &lt;code&gt;-run&lt;/code&gt; and other flags.&lt;/p&gt;</description></item><item><title>MMv1 sample reference</title><link>https://googlecloudplatform.github.io/magic-modules/reference/sample/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/sample/</guid><description>&lt;h1 id="mmv1-sample-reference"&gt;MMv1 sample reference&lt;a class="anchor" href="#mmv1-sample-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A sample is a collection of one or more &lt;code&gt;steps&lt;/code&gt;, where each step represents a distinct Terraform configuration and test step (for example, create, update).&lt;/p&gt;
&lt;p&gt;Each sample supports the following attributes at the top level, with more granular control inside each step.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="sample-attributes-top-level"&gt;Sample Attributes (Top-Level)&lt;a class="anchor" href="#sample-attributes-top-level"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These attributes are defined once for an entire sample.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;/code&gt;: &lt;code&gt;snake_case&lt;/code&gt; name for the overall sample. This is used for generating test names.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;primary_resource_id&lt;/code&gt;: The ID of the main resource under test for the entire sample. Tests use this to run additional checks automatically.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;primary_resource_type&lt;/code&gt;: Optional resource type override of the primary resource. Used for import assertion validations.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bootstrap_iam&lt;/code&gt;: Specify member/role pairs that should exist before the test runs. This avoids race conditions on global IAM permissions. &lt;code&gt;{project_number}&lt;/code&gt; and &lt;code&gt;{organization_id}&lt;/code&gt; are replaced automatically.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min_version&lt;/code&gt;: Sets a minimum provider version for the entire sample (for example, &lt;code&gt;beta&lt;/code&gt;). This can be overridden by the &lt;code&gt;min_version&lt;/code&gt; attribute within a specific step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclude_test&lt;/code&gt;: If &lt;code&gt;true&lt;/code&gt;, no tests are generated for this entire sample.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclude_basic_doc&lt;/code&gt;: If &lt;code&gt;true&lt;/code&gt;, excludes the first step of this sample from the generated documentation. By default, the first step is automatically included as a use case in the documentation. Use this if you want to skip it.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;skip_vcr&lt;/code&gt;: If &lt;code&gt;true&lt;/code&gt;, skips VCR testing for the entire sample.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;skip_test&lt;/code&gt;: If not empty, the entire sample is skipped during tests. The value should be a link to a ticket explaining why.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;skip_func&lt;/code&gt;: A custom function call to run to determine if tests should be skipped.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;region_override&lt;/code&gt;: Overrides location/region identifiers specifically inside IAM assertion checks.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;external_providers&lt;/code&gt;: A list of external providers (such as &lt;code&gt;random&lt;/code&gt;, &lt;code&gt;time&lt;/code&gt;) needed for the sample.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tgc_skip_test&lt;/code&gt;: Skips generated conversion tests specifically running inside the TGC (Terraform Google Conversion) suite (value should be a ticket link reason).&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="step-attributes"&gt;Step Attributes&lt;a class="anchor" href="#step-attributes"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A sample contains a list of one or more &lt;code&gt;steps&lt;/code&gt;. Each step has its own configuration and test-specific attributes.&lt;/p&gt;</description></item><item><title>Add a field to an existing resource</title><link>https://googlecloudplatform.github.io/magic-modules/develop/add-fields/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/add-fields/</guid><description>&lt;h1 id="add-a-field-to-an-existing-resource"&gt;Add a field to an existing resource&lt;a class="anchor" href="#add-a-field-to-an-existing-resource"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page describes how to add a field to an existing resource in the &lt;code&gt;google&lt;/code&gt; or &lt;code&gt;google-beta&lt;/code&gt; Terraform
provider using MMv1 and/or handwritten code. In general, Terraform resources should implement all configurable
fields and all read-only fields. Even fields that seem like they would not be useful in Terraform
(like update time or etag) often end up being requested by users, so it&amp;rsquo;s usually easier to just add them all at
once. However, optional or read-only fields can be omitted when adding a resource if they would require significant
additional work to implement.&lt;/p&gt;</description></item><item><title>Labels and annotations</title><link>https://googlecloudplatform.github.io/magic-modules/best-practices/labels-and-annotations/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/best-practices/labels-and-annotations/</guid><description>&lt;h1 id="add-labels-and-annotations-support"&gt;Add labels and annotations support&lt;a class="anchor" href="#add-labels-and-annotations-support"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This page covers best practices guidance for the Terraform provider for Google Cloud, which is used to ensure a consistent UX for Terraform users across providers or GCP users across the Google provider. Generally, this guidance should be followed and exceptions should be clearly demarcated / discussed.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The new labels model and the new annotations model are introduced in &lt;a href="https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/version_5_upgrade#provider"&gt;Terraform provider for Google Cloud 5.0.0&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>make commands</title><link>https://googlecloudplatform.github.io/magic-modules/reference/make-commands/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/make-commands/</guid><description>&lt;h1 id="make-commands-reference"&gt;&lt;code&gt;make&lt;/code&gt; commands reference&lt;a class="anchor" href="#make-commands-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="magic-modules"&gt;&lt;code&gt;magic-modules&lt;/code&gt;&lt;a class="anchor" href="#magic-modules"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="make--make-provider"&gt;&lt;code&gt;make&lt;/code&gt; / &lt;code&gt;make provider&lt;/code&gt;&lt;a class="anchor" href="#make--make-provider"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Generates the code for the downstream &lt;code&gt;google&lt;/code&gt; and &lt;code&gt;google-beta&lt;/code&gt; providers
into the &lt;code&gt;OUTPUT_PATH&lt;/code&gt;, overriding and deleting any local changes.&lt;/p&gt;
&lt;blockquote class='book-hint note'&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Generation works best if the downstream provider has a commit checked out corresponding to the latest &lt;code&gt;main&lt;/code&gt; branch commit that is present in your &lt;code&gt;magic-modules&lt;/code&gt; working branch. This can generally be identified based on matching commit messages.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Examples:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;make provider &lt;span style="color:#ff5c57"&gt;VERSION&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;ga &lt;span style="color:#ff5c57"&gt;OUTPUT_PATH&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;&lt;span style="color:#5af78e"&gt;&amp;#34;&lt;/span&gt;&lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;&lt;span style="color:#5af78e"&gt;/src/github.com/hashicorp/terraform-provider-google&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;make provider &lt;span style="color:#ff5c57"&gt;VERSION&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;beta &lt;span style="color:#ff5c57"&gt;OUTPUT_PATH&lt;/span&gt;&lt;span style="color:#ff6ac1"&gt;=&lt;/span&gt;&lt;span style="color:#5af78e"&gt;&amp;#34;&lt;/span&gt;&lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;&lt;span style="color:#5af78e"&gt;/src/github.com/hashicorp/terraform-provider-google-beta&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id="arguments"&gt;Arguments&lt;a class="anchor" href="#arguments"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;OUTPUT_PATH&lt;/code&gt;: Required. The location you are generating provider code into.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;/code&gt;: Required. The version of the provider you are building into. Valid values are &lt;code&gt;ga&lt;/code&gt; and &lt;code&gt;beta&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PRODUCT&lt;/code&gt;: Limits generations to the specified folder within &lt;code&gt;mmv1/products&lt;/code&gt;. Handwritten files from &lt;code&gt;mmv1/third_party/terraform&lt;/code&gt; are always generated into the downstream regardless of this setting, so you can provide a non-existent product name to generate only handwritten code. Required if &lt;code&gt;RESOURCE&lt;/code&gt; is specified. &lt;strong&gt;Using &lt;code&gt;PRODUCT&lt;/code&gt; skips the pre-generation cleanup step. This is considered advanced usage; recommend running a full, clean build (&lt;code&gt;make provider&lt;/code&gt; without &lt;code&gt;PRODUCT&lt;/code&gt;) beforehand if repositories may be out of sync.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SKIP_CLEAN&lt;/code&gt;: If set to &lt;code&gt;true&lt;/code&gt;, skips the default pre-generation cleanup of &lt;code&gt;OUTPUT_PATH&lt;/code&gt; during a full provider build. Has no effect if &lt;code&gt;PRODUCT&lt;/code&gt; is specified (as cleanup is already skipped). Example: &lt;code&gt;make provider VERSION=ga OUTPUT_PATH=... SKIP_CLEAN=true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RESOURCE&lt;/code&gt;: Limits generation to the specified resource within a particular product. For &lt;code&gt;mmv1&lt;/code&gt; resources, matches the resource&amp;rsquo;s &lt;code&gt;name&lt;/code&gt; field (set in its configuration file).&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="cleaning-up-old-files"&gt;Cleaning up old files&lt;a class="anchor" href="#cleaning-up-old-files"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Magic Modules will only generate on top of whatever is in the downstream repository. This means that, from time
to time, you may end up with stale files or changes in your downstream that cause compilation or tests to fail.&lt;/p&gt;</description></item><item><title>Write release notes</title><link>https://googlecloudplatform.github.io/magic-modules/code-review/release-notes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/code-review/release-notes/</guid><description>&lt;h1 id="write-release-notes"&gt;Write release notes&lt;a class="anchor" href="#write-release-notes"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide explains best practices for composing accurate, end-user focused release notes for Magic Modules pull requests.&lt;/p&gt;
&lt;p&gt;Every pull request must have at least one release note block in the opening comment. Release note blocks have the following format:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;``&lt;span style="color:#5af78e"&gt;`release-note:TYPE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;CONTENT
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt;`&lt;/span&gt;``&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Replace &lt;code&gt;TYPE&lt;/code&gt; with the correct release note type, and &lt;code&gt;CONTENT&lt;/code&gt; with a release note written according to the guidelines in the following sections.&lt;/p&gt;
&lt;h2 id="general-guidelines"&gt;General guidelines&lt;a class="anchor" href="#general-guidelines"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Do&lt;/th&gt;
 &lt;th&gt;Don&amp;rsquo;t&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;Only have one &lt;code&gt;CONTENT&lt;/code&gt; line per release note block. Use multiple blocks if there are multiple related changes in a single PR.&lt;/td&gt;
 &lt;td&gt;Don&amp;rsquo;t add multiple lines to a single release note block. Avoid combining multiple distinct types of changes into one release block.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;If a change only affects the &lt;code&gt;google-beta&lt;/code&gt; provider add &lt;code&gt;(beta)&lt;/code&gt; to the end of the release note. If a change only affects the &lt;code&gt;google&lt;/code&gt; provider add &lt;code&gt;(ga)&lt;/code&gt; to the end of the release note.&lt;/td&gt;
 &lt;td&gt;Don&amp;rsquo;t add either suffix if the change affects both providers.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;Set an appropriate release note type.&lt;/td&gt;
 &lt;td&gt;Don&amp;rsquo;t leave the type as &lt;code&gt;REPLACEME&lt;/code&gt;.&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="type-specific-guidelines-and-examples"&gt;Type-specific guidelines and examples&lt;a class="anchor" href="#type-specific-guidelines-and-examples"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-0" id="tabs-0-0" checked="checked" /&gt;&lt;label for="tabs-0-0"&gt;New field(s)&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;p&gt;Write your release note in the following format:&lt;/p&gt;</description></item><item><title>Metadata (meta.yaml) reference</title><link>https://googlecloudplatform.github.io/magic-modules/reference/metadata/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/metadata/</guid><description>&lt;h1 id="metadata-metayaml-reference"&gt;Metadata (meta.yaml) reference&lt;a class="anchor" href="#metadata-metayaml-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page documents the properties available in meta.yaml files. These files make it easy to access data about the provider implementation without needing to compile the provider. They are used for coverage metrics and CAI-related overrides.&lt;/p&gt;
&lt;p&gt;Meta.yaml files are auto-generated for MMv1 generated resources.&lt;/p&gt;
&lt;p&gt;Handwritten resources will have handwritten meta.yaml files in the appropriate service directory in &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services"&gt;mmv1/third_party/terraform/services/&lt;/a&gt;. The file name will be &lt;code&gt;resource_PRODUCT_RESOURCE_meta.yaml(.tmpl)&lt;/code&gt;. For example, &lt;code&gt;resource_compute_instance_meta.yaml.tmpl&lt;/code&gt; Handwritten meta.yaml files with a &lt;code&gt;.tmpl&lt;/code&gt; extension can use version guards (&lt;code&gt;{{- if ne $.TargetVersionName &amp;quot;ga&amp;quot; }}...{{- else}}...{{- end}}&lt;/code&gt;) to exclude beta fields from the &lt;code&gt;google&lt;/code&gt; provider.&lt;/p&gt;</description></item><item><title>Add IAM support</title><link>https://googlecloudplatform.github.io/magic-modules/develop/add-iam-support/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/add-iam-support/</guid><description>&lt;h1 id="add-iam-support"&gt;Add IAM support&lt;a class="anchor" href="#add-iam-support"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page covers how to add IAM resources in Terraform if they are supported by a particular API resource (indicated by
&lt;code&gt;setIamPolicy&lt;/code&gt; and &lt;code&gt;getIamPolicy&lt;/code&gt; methods in the API documentation for the resource).&lt;/p&gt;
&lt;p&gt;For more information about types of resources and the generation process overall, see &lt;a href="https://googlecloudplatform.github.io/magic-modules/"&gt;How Magic Modules works&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Complete the steps in &lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt; to set up your environment and your Google Cloud project.&lt;/li&gt;
&lt;li&gt;Ensure that your &lt;code&gt;magic-modules&lt;/code&gt;, &lt;code&gt;terraform-provider-google&lt;/code&gt;, and &lt;code&gt;terraform-provider-google-beta&lt;/code&gt; repositories are up to date.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; ~/magic-modules
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google-beta
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git checkout main &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clean -f . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git checkout -- . &lt;span style="color:#ff6ac1"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git pull&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="add-iam-support-1"&gt;Add IAM support&lt;a class="anchor" href="#add-iam-support-1"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-IAM" id="tabs-IAM-0" checked="checked" /&gt;&lt;label for="tabs-IAM-0"&gt;MMv1&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;p&gt;IAM support for MMv1-generated resources is configured within the &lt;code&gt;ResourceName.yaml&lt;/code&gt; file, and will create the &lt;code&gt;google_product_resource_iam_policy&lt;/code&gt;, &lt;code&gt;google_product_resource_iam_binding&lt;/code&gt;, &lt;code&gt;google_product_resource_iam_member&lt;/code&gt; resource, website, and test files for that resource target when an &lt;code&gt;iam_policy&lt;/code&gt; block is present.&lt;/p&gt;</description></item><item><title>Common resource patterns</title><link>https://googlecloudplatform.github.io/magic-modules/best-practices/common-resource-patterns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/best-practices/common-resource-patterns/</guid><description>&lt;h1 id="common-resource-patterns"&gt;Common resource patterns&lt;a class="anchor" href="#common-resource-patterns"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="singletons"&gt;Singletons&lt;a class="anchor" href="#singletons"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Singletons are resources – often config or settings objects – that can only exist once. In some cases, it may be possible to create and delete the resource (but only one can exist at a time); in other cases the resource &lt;em&gt;always&lt;/em&gt; exists and can only be read and updated.&lt;/p&gt;
&lt;p&gt;Implementing resources like this may require some or all of the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If there &lt;em&gt;isn&amp;rsquo;t&lt;/em&gt; a create endpoint, set the &lt;a href="https://googlecloudplatform.github.io/magic-modules/reference/resource/#create_url"&gt;create_url&lt;/a&gt; to point to the update endpoint.&lt;/li&gt;
&lt;li&gt;If there &lt;em&gt;is&lt;/em&gt; a create endpoint, add &lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/custom-code/#pre_post_injection"&gt;pre-create custom code&lt;/a&gt; that implements &amp;ldquo;acquire-on-create&amp;rdquo; 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 &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/dc4d9755cb9288177e0996c1c3b3fa9738ebdf89/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl"&gt;mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl&lt;/a&gt;.
&lt;ul&gt;
&lt;li&gt;Note: The main disadvantage of &amp;ldquo;acquire-on-create&amp;rdquo; logic is that users will not be presented with a diff between the resource&amp;rsquo;s old and new states – because from the terraform perspective, the resource is only being created. Please upvote &lt;a href="https://github.com/hashicorp/terraform/issues/19017"&gt;https://github.com/hashicorp/terraform/issues/19017&lt;/a&gt; to request better support for this workflow.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;If there is no delete endpoint, set &lt;a href="https://googlecloudplatform.github.io/magic-modules/reference/resource/#create_url"&gt;&lt;code&gt;exclude_delete: true&lt;/code&gt;&lt;/a&gt; at the top level of the resource.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Tests for singletons can run into issues because they are modifying a shared state. To avoid the problems this can cause, ensure that the tests &lt;a href="https://googlecloudplatform.github.io/magic-modules/test/test/#create-test-projects"&gt;create dedicated parent resources&lt;/a&gt; instead of modifying the default test environment. If there need to be multiple test cases, make sure they either have individual parent resources, or that they run serially, like &lt;a href="https://github.com/hashicorp/terraform-provider-google-beta/blob/88fa0756f2ce116765edd4c1551680d9029621f6/google-beta/services/accesscontextmanager/resource_access_context_manager_access_policy_test.go#L31-L33"&gt;TestAccAccessContextManager&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Ruby to Go Migration</title><link>https://googlecloudplatform.github.io/magic-modules/reference/ruby-go-changes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/ruby-go-changes/</guid><description>&lt;h1 id="what-has-changed-in-the-mmv1-go-migration"&gt;What has changed in the MMv1 Go migration&lt;a class="anchor" href="#what-has-changed-in-the-mmv1-go-migration"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The Magic Modules code generator has been rewritten from Ruby to Go. For experienced contributors, this reference document lists what the expected changes are to the previous development workflow in Ruby.&lt;/p&gt;
&lt;h2 id="yaml-changes"&gt;YAML changes&lt;a class="anchor" href="#yaml-changes"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;.yaml&lt;/code&gt; files within &lt;code&gt;mmv1/products&lt;/code&gt; have had adjustments to the attribute typing. The initial Ruby lines &lt;code&gt;!ruby/object:Api::Type::&amp;lt;TYPE&amp;gt;&lt;/code&gt; have been removed and replaced with a simpler &lt;code&gt;type: &amp;lt;TYPE&amp;gt;&lt;/code&gt; line.&lt;/p&gt;
&lt;p&gt;Old Ruby YAML&lt;/p&gt;</description></item><item><title>Test Template Migration Guide</title><link>https://googlecloudplatform.github.io/magic-modules/reference/update-test-changes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/reference/update-test-changes/</guid><description>&lt;h1 id="test-template-migration-guide"&gt;Test Template Migration Guide&lt;a class="anchor" href="#test-template-migration-guide"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The test generation framework in Magic Modules has been updated to natively support multi-step tests (create and update) directly from the resource&amp;rsquo;s YAML definition. This guide is for experienced contributors who are familiar with the previous &lt;code&gt;examples&lt;/code&gt; based workflow and provides a concise overview of what has changed.&lt;/p&gt;
&lt;h2 id="transition-timeline"&gt;Transition Timeline&lt;a class="anchor" href="#transition-timeline"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Recommended Path:&lt;/strong&gt; The new &lt;code&gt;samples&lt;/code&gt; configuration block is the recommended path for adding tests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Legacy Support:&lt;/strong&gt; The old &lt;code&gt;examples&lt;/code&gt; block path is still supported until Mid May 2026.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Action Required:&lt;/strong&gt; Contributors are encouraged to use &lt;code&gt;samples&lt;/code&gt; for all new tests and migrate existing &lt;code&gt;examples&lt;/code&gt; to &lt;code&gt;samples&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="yaml-changes-from-examples-to-samples-and-steps"&gt;YAML Changes: From &lt;code&gt;examples&lt;/code&gt; to &lt;code&gt;samples&lt;/code&gt; and &lt;code&gt;steps&lt;/code&gt;&lt;a class="anchor" href="#yaml-changes-from-examples-to-samples-and-steps"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The most significant change is the replacement of the &lt;code&gt;examples&lt;/code&gt; block with a new &lt;code&gt;samples&lt;/code&gt; block. Each &lt;code&gt;sample&lt;/code&gt; can now contain one or more &lt;code&gt;steps&lt;/code&gt;, where the first step corresponds to the resource creation and any subsequent steps correspond to updates.&lt;/p&gt;</description></item><item><title>Validation</title><link>https://googlecloudplatform.github.io/magic-modules/best-practices/validation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/best-practices/validation/</guid><description>&lt;h1 id="validation"&gt;Validation&lt;a class="anchor" href="#validation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;There are a number of ways to add client-side validation to resources. The benefit of client-side validation is that errors can be surfaced at plan time, instead of partway through a (potentially very long) apply process, allowing for faster iteration. However, the tradeoff is that client-side validation can get out of sync with server-side validation, creating additional maintenance burden for the provider and preventing users from accessing the latest features without upgrading.&lt;/p&gt;</description></item><item><title>Add a datasource</title><link>https://googlecloudplatform.github.io/magic-modules/develop/add-handwritten-datasource/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/add-handwritten-datasource/</guid><description>Datasources are like terraform resources except they don&amp;rsquo;t &lt;em&gt;create&lt;/em&gt; anything.</description></item><item><title>Add custom resource code</title><link>https://googlecloudplatform.github.io/magic-modules/develop/custom-code/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/custom-code/</guid><description>&lt;h1 id="add-custom-resource-code"&gt;Add custom resource code&lt;a class="anchor" href="#add-custom-resource-code"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This document covers how to add &amp;ldquo;custom code&amp;rdquo; to &lt;a href="https://googlecloudplatform.github.io/magic-modules/#mmv1"&gt;MMv1 resources&lt;/a&gt;. Custom code can be used to add arbitrary logic to a resource while still generating most of the code; it allows for a balance between maintainability and supporting real-worlds APIs that deviate from what MMv1 can support. Custom code should only be added if the desired behavior can&amp;rsquo;t be achieved otherwise.&lt;/p&gt;
&lt;p&gt;Most custom code attributes are strings that contain a path to a template file relative to the &lt;code&gt;mmv1&lt;/code&gt; directory. For example:&lt;/p&gt;</description></item><item><title>Promote to GA</title><link>https://googlecloudplatform.github.io/magic-modules/develop/promote-to-ga/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/promote-to-ga/</guid><description>&lt;h1 id="promote-from-beta-to-ga"&gt;Promote from beta to GA&lt;a class="anchor" href="#promote-from-beta-to-ga"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This document describes how to promote an existing resource or field that uses MMv1 and/or handwritten code from the &lt;code&gt;google-beta&lt;/code&gt; provider to the &lt;code&gt;google&lt;/code&gt; (also known as &amp;ldquo;GA&amp;rdquo;) provider.&lt;/p&gt;
&lt;p&gt;Handwritten code (including &lt;code&gt;custom_code&lt;/code&gt;) commonly uses &amp;ldquo;version guards&amp;rdquo; in the form of &lt;code&gt;{{- if ne $.TargetVersionName &amp;quot;ga&amp;quot; }}...{{- end }}&lt;/code&gt; to wrap code that is beta-specific, which need to be removed during promotion.&lt;/p&gt;
&lt;p&gt;For more information about types of resources and the generation process overall, see &lt;a href="https://googlecloudplatform.github.io/magic-modules/"&gt;How Magic Modules works&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Update dependencies</title><link>https://googlecloudplatform.github.io/magic-modules/develop/update-dependencies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/update-dependencies/</guid><description>&lt;h1 id="update-provider-dependencies"&gt;Update provider dependencies&lt;a class="anchor" href="#update-provider-dependencies"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The Magic Modules repository does not contain a complete Go module, preventing the use of automated tooling like &lt;code&gt;go get&lt;/code&gt; from that repository. To add or update provider dependencies, use standard Go tooling to update the dependency in the &lt;code&gt;terraform-provider-google&lt;/code&gt; provider and copy the results to the upstream files in Magic Modules.&lt;/p&gt;
&lt;p&gt;Below are the steps you can follow to make the change:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to the local &lt;code&gt;google&lt;/code&gt; provider directory:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff5c57"&gt;cd&lt;/span&gt; &lt;span style="color:#ff5c57"&gt;$GOPATH&lt;/span&gt;/src/github.com/hashicorp/terraform-provider-google&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Open the &lt;a href="https://github.com/hashicorp/terraform-provider-google/blob/main/go.mod"&gt;&lt;code&gt;go.mod&lt;/code&gt;&lt;/a&gt; file and add the new entries or modify the versions of existing entries as needed&lt;/li&gt;
&lt;li&gt;Update dependencies using either of the following methods
&lt;ul&gt;
&lt;li&gt;run the following commands to update all dependencies:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;go get
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;go mod tidy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Alternatively, update a specific package to a desired version:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;go get google.golang.org/api@v0.105.0 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;go mod tidy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Copy the contents of the updated &lt;code&gt;go.mod&lt;/code&gt; and &lt;code&gt;go.sum&lt;/code&gt; file into &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/go.mod"&gt;&lt;code&gt;mmv1/third_party/terraform/go.mod&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/go.sum"&gt;&lt;code&gt;mmv1/third_party/terraform/go.sum&lt;/code&gt;&lt;/a&gt; in the &lt;code&gt;magic-modules&lt;/code&gt; respectively.&lt;/li&gt;
&lt;li&gt;Create a pull request containing &lt;em&gt;only&lt;/em&gt; the dependency changes.&lt;/li&gt;
&lt;li&gt;Resolve any errors caused by the dependency upgrade.&lt;/li&gt;
&lt;li&gt;After the dependency pull request is merged, continue with a separate pull request for any additional changes that were blocked by the upgrade.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Fix diffs</title><link>https://googlecloudplatform.github.io/magic-modules/develop/diffs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/diffs/</guid><description>&lt;h1 id="fix-diffs"&gt;Fix diffs&lt;a class="anchor" href="#fix-diffs"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This page outlines best practices for fixing various kinds of diffs that can show up at plan time. These will often show up as test failures with the text: &lt;code&gt;After applying this test step, the plan was not empty.&lt;/code&gt;. They can also show up for users at plan time, on fields that a user has not modified in their configuration. If the diff does not go away even after running &lt;code&gt;terraform apply&lt;/code&gt; more than once with the same configuration, the diff is called a &amp;ldquo;permadiff&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Generate the providers</title><link>https://googlecloudplatform.github.io/magic-modules/develop/generate-providers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/generate-providers/</guid><description>&lt;h1 id="generate-google-and-google-beta-providers"&gt;Generate &lt;code&gt;google&lt;/code&gt; and &lt;code&gt;google-beta&lt;/code&gt; providers&lt;a class="anchor" href="#generate-google-and-google-beta-providers"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;After making a change to the Terraform providers for Google Cloud, you must
integrate your changes with the providers. This page explains how to generate
provider changes to the &lt;code&gt;google&lt;/code&gt; and &lt;code&gt;google-beta&lt;/code&gt; Terraform providers.&lt;/p&gt;
&lt;h2 id="before-you-begin"&gt;Before you begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/set-up-dev-environment/"&gt;Set up your development environment&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Update &lt;code&gt;magic-modules&lt;/code&gt; as needed. These updates could be any of the following changes:&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/add-resource/"&gt;Adding a resource&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/add-handwritten-datasource/"&gt;Adding a datasource&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/custom-code/"&gt;Adding custom resource code&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://googlecloudplatform.github.io/magic-modules/develop/promote-to-ga/"&gt;Promoting a resource to GA&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By default, running a full &lt;code&gt;make provider&lt;/code&gt; command cleans the output directory (&lt;code&gt;OUTPUT_PATH&lt;/code&gt;) before generating code to prevent sync issues. This will override and delete any changes to that directory. See the &lt;a href="https://googlecloudplatform.github.io/magic-modules/reference/make-commands/"&gt;&lt;code&gt;make&lt;/code&gt; commands reference&lt;/a&gt; for details on advanced usage.&lt;/p&gt;</description></item><item><title>Client-side fields</title><link>https://googlecloudplatform.github.io/magic-modules/develop/client-side-fields/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://googlecloudplatform.github.io/magic-modules/develop/client-side-fields/</guid><description>&lt;h1 id="client-side-fields"&gt;Client-side fields&lt;a class="anchor" href="#client-side-fields"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Client-side fields are most often used as flags to modify the behavior of a Terraform resource. Because they don&amp;rsquo;t correspond to an API field, there are some additional considerations in terms of how to implement them.&lt;/p&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-schema" id="tabs-schema-0" checked="checked" /&gt;&lt;label for="tabs-schema-0"&gt;MMv1&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;h2 id="add-to-the-schema"&gt;Add to the schema&lt;a class="anchor" href="#add-to-the-schema"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Instead of adding the field in &lt;code&gt;parameters&lt;/code&gt; or &lt;code&gt;properties&lt;/code&gt;, use a section called &lt;code&gt;virtual_fields&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#e2e4e5;background-color:#282a36;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ff6ac1"&gt;virtual_fields&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; - &lt;span style="color:#ff6ac1"&gt;name&lt;/span&gt;: &lt;span style="color:#5af78e"&gt;&amp;#39;send_propagated_connection_limit_if_zero&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff6ac1"&gt;type&lt;/span&gt;: Boolean
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff6ac1"&gt;default_value&lt;/span&gt;: &lt;span style="color:#ff6ac1"&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff6ac1"&gt;description&lt;/span&gt;: |&lt;span style="color:#5af78e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; Controls the behavior of propagated_connection_limit.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; When false, setting propagated_connection_limit to zero causes the provider to use to the API&amp;#39;s default value.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; When true, the provider will set propagated_connection_limit to zero.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#5af78e"&gt; Defaults to false.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;input type="radio" class="toggle" name="tabs-schema" id="tabs-schema-1" /&gt;&lt;label for="tabs-schema-1"&gt;Handwritten&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;h2 id="add-to-the-schema-1"&gt;Add to the schema&lt;a class="anchor" href="#add-to-the-schema-1"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Add the field to the schema as usual.&lt;/p&gt;</description></item></channel></rss>