forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updategenproviders (GoogleCloudPlatform#12350)
Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
- Loading branch information
Showing
14 changed files
with
196 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: "Fix diffs" | ||
weight: 60 | ||
weight: 18 | ||
aliases: | ||
- /develop/permadiff | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: "Generate the providers" | ||
weight: 19 | ||
aliases: | ||
- /docs/getting-started/setup | ||
- /getting-started/setup | ||
- /docs/getting-started/generate-providers | ||
- /getting-started/generate-providers | ||
- /get-started/generate-providers | ||
--- | ||
|
||
# Generate `google` and `google-beta` providers | ||
|
||
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 `google` and `google-beta` Terraform providers. | ||
|
||
## Before you begin | ||
|
||
1. [Set up your development environment]({{< ref "/develop/set-up-dev-environment" >}}). | ||
1. Update `magic-modules` as needed. These updates could be any of the following changes: | ||
+ [Adding or modifying a resource]({{< ref "/develop/resource" >}}). | ||
+ [Adding a datasource]({{< ref "/develop/add-handwritten-datasource" >}}). | ||
+ [Adding custom resource code]({{< ref "/develop/custom-code" >}}). | ||
+ [Promoting a resource to GA]({{< ref "/develop/promote-to-ga" >}}). | ||
|
||
## Generate a provider change | ||
|
||
1. Clone the `google` and `google-beta` provider repositories with the following commands: | ||
|
||
```bash | ||
git clone https://github.com/hashicorp/terraform-provider-google.git $GOPATH/src/github.com/hashicorp/terraform-provider-google | ||
git clone https://github.com/hashicorp/terraform-provider-google-beta.git $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta | ||
``` | ||
1. Generate changes for the `google` provider: | ||
```bash | ||
make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=[PRODUCT_NAME] | ||
``` | ||
Where `[PRODUCT_NAME]` is one of the folder names in | ||
https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products. | ||
|
||
For example, if your product is `bigqueryanalyticshub`, the command would be | ||
the following: | ||
|
||
```bash | ||
make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=bigqueryanalyticshub | ||
``` | ||
|
||
1. Generate changes for the `google-beta` provider: | ||
```bash | ||
make provider VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" PRODUCT=[PRODUCT_NAME] | ||
``` | ||
|
||
Where `[PRODUCT_NAME]` is one of the folder names in https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products. | ||
|
||
For example, if your product name is `bigqueryanalyticshub`, the command would be the following: | ||
|
||
```bash | ||
make provider VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" PRODUCT=bigqueryanalyticshub | ||
``` | ||
|
||
1. Confirm that the expected changes were generated: | ||
```bash | ||
cd $GOPATH/src/github.com/hashicorp/terraform-provider-google | ||
git diff -U0 | ||
cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta | ||
git diff -U0 | ||
``` | ||
|
||
|
||
{{< hint info >}} | ||
**Note**: There may be additional changes present due to specifying a | ||
`PRODUCT=` value or due to the `magic-modules` repository being out of sync | ||
with the provider repositories. | ||
{{< /hint >}} | ||
|
||
|
||
## Troubleshoot | ||
|
||
### Too many open files {#too-many-open-files} | ||
|
||
If you are getting “Too many open files” ulimit needs to be raised. | ||
|
||
{{< tabs "ulimit" >}} | ||
{{< tab "Mac OS" >}} | ||
```bash | ||
ulimit -n 8192 | ||
``` | ||
{{< /tab >}} | ||
{{< /tabs >}} | ||
|
||
## What's next | ||
|
||
+ [Learn how to add resource tests]({{< ref "/develop/test/test" >}}) | ||
+ [Learn how to run tests]({{< ref "/develop/test/run-tests" >}}) | ||
+ [Learn about `make` commands]({{< ref "/reference/make-commands" >}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: "Set up your development environment" | ||
weight: 12 | ||
--- | ||
|
||
# Set up your development environment | ||
|
||
Before you start adding or updating a Terraform resource using | ||
[magic-modules]({{< ref "/" >}}), you must first set up your environment by | ||
installing the necessary tools. This page explains the steps for setting up your | ||
development environment. | ||
|
||
1. [Install the gcloud CLI.](https://cloud.google.com/sdk/docs/install) | ||
1. In the Google Cloud console, on the project selector page, select or | ||
[create a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects). | ||
{{< hint info >}} | ||
|
||
**Note:** If you don'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. | ||
|
||
{{< /hint >}} | ||
{{< button href="https://console.cloud.google.com/projectselector2/home/dashboard" >}}Go to project selector{{< /button >}} | ||
1. Make sure that billing is enabled for your Google Cloud project. Learn how to | ||
[check if billing is enabled on a project](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled). | ||
|
||
|
||
1. [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) | ||
1. [Install go](https://go.dev/doc/install) | ||
1. Add the following values to your environment settings such as `.bashrc`: | ||
```bash | ||
# Add GOPATH variable for convenience | ||
export GOPATH=$(go env GOPATH) | ||
# Add Go binaries to PATH | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
``` | ||
1. Install goimports | ||
```bash | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
``` | ||
1. [Install terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) | ||
1. Clone the `magic-modules` repository | ||
```bash | ||
cd ~ | ||
git clone https://github.com/GoogleCloudPlatform/magic-modules.git | ||
``` | ||
|
||
1. Run the following command from the root of your cloned `magic-modules` repository. | ||
|
||
```bash | ||
cd magic-modules | ||
./scripts/doctor | ||
``` | ||
|
||
Expected output if everything is installed properly: | ||
|
||
``` | ||
Check for go in path... | ||
found! | ||
Check for goimports in path... | ||
found! | ||
Check for git in path... | ||
found! | ||
Check for terraform in path... | ||
found! | ||
Check for make in path... | ||
found! | ||
``` | ||
|
||
## What's next | ||
|
||
+ [Learn how to add or modify a resource]({{< ref "/develop/resource" >}}) | ||
+ [Learn how to add custom resource code]({{< ref "/develop/custom-code" >}}) | ||
+ [Learn how to add a datasource]({{< ref "/develop/add-handwritten-datasource" >}}) | ||
+ [Learn how to promote a resource to GA]({{< ref "/develop/promote-to-ga" >}}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: "Update dependencies" | ||
weight: 300 | ||
weight: 17 | ||
aliases: | ||
- /docs/update-dependencies | ||
--- | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.