-
Notifications
You must be signed in to change notification settings - Fork 701
Update terraform new resource docs #21140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Hi @FingerLeader. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @FingerLeader, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces new documentation for using the TiDB Cloud Terraform provider to manage Dedicated clusters. It provides step-by-step guides and examples for creating, modifying, importing, and deleting dedicated clusters and their components (like TiFlash and additional TiDB node groups) using Infrastructure as Code principles.
Highlights
- New Documentation: Added a comprehensive new documentation page (
tidb-cloud/terraform-use-dedicated-cluster-resource.md
) detailing how to manage TiDB Cloud Dedicated clusters using thetidbcloud_dedicated_cluster
Terraform resource. - Resource Management: The new document covers the full lifecycle of a dedicated cluster via Terraform, including creation, modification (adding TiFlash, scaling, pausing/resuming), adding/updating/deleting TiDB node groups, importing existing clusters, and deletion.
- Terraform Examples: Includes detailed Terraform HCL code examples and corresponding
terraform apply
,terraform state show
, andterraform show
command outputs for each operation (create, modify, delete, import). - Data Source Usage: Explains how to use the
tidbcloud_projects
data source to retrieve project IDs necessary for cluster creation.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new documentation page for the tidbcloud_dedicated_cluster
Terraform resource. The document is comprehensive, covering creation, modification (including TiFlash, scaling, pausing/resuming, and node group management), importing, and deleting dedicated clusters. It also explains how to use the tidbcloud_projects
data source.
The review focuses on resolving TO DO items, ensuring consistency in examples (especially resource names like example_cluster
), correcting internal links, improving the clarity of steps and explanations, and adhering to markdown and language style guidelines. Specific suggestions include rephrasing for formality and conciseness, and correcting list numbering for better logical flow.
<!-- TO DO --> | ||
> **Note:** | ||
> | ||
> Before you begin, make sure that you have set a CIDR in the TiDB Cloud console. For more information, see [Set a CIDR](/tidb-cloud/set-up-vpc-peering-connections.md#prerequisite-set-a-cidr-for-a-region). You can also [create a `dedicated_network_container` resource](xxxx) to manage your CIDR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section contains a "TO DO" comment and a placeholder link (xxxx)
.
- Please remove the
<!-- TO DO -->
comment if there's no specific pending information for this exact spot. - The link
(xxxx)
fordedicated_network_container
resource needs to be updated with the correct URL if the document exists, or the sentence should be rephrased/removed if the resource or its documentation is not yet available.
Enter a value: yes | ||
|
||
tidbcloud_dedicated_cluster.example_cluster: Creating... | ||
tidbcloud_dedicated_cluster.example: Still creating... [10s elapsed] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resource name in this example output is example
, but the Terraform configuration (e.g., line 150) uses example_cluster
. This inconsistency appears in several example outputs throughout the document. Please ensure all example outputs consistently use example_cluster
to match the defined resource name.
tidbcloud_dedicated_cluster.example: Still creating... [10s elapsed] | |
tidbcloud_dedicated_cluster.example_cluster: Still creating... [10s elapsed] |
1. Add an import block for the new dedicated cluster resource | ||
|
||
- Add the following import block to your `.tf` file, replace `example` with a desired resource name, and replace `${id}` with the cluster ID: | ||
|
||
``` | ||
import { | ||
to = tidbcloud_dedicated_cluster.example_cluster | ||
id = "${id}" | ||
} | ||
``` | ||
2. Generate the new configuration file | ||
|
||
Generate the new configuration file for the new dedicated cluster resource according to the import block: | ||
|
||
```shell | ||
terraform plan -generate-config-out=generated.tf | ||
``` | ||
|
||
Do not specify an existing `.tf` file name in the preceding command. Otherwise, Terraform will return an error. | ||
|
||
1. Review and apply the generated configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The numbering for the steps under "Import a cluster" is inconsistent. Step "1. Add an import block..." is followed by sub-step "- Add the following...". Then step "2. Generate..." is followed by a step incorrectly numbered as "1. Review and apply...". This should be "3. Review and apply...". Please ensure consistent and sequential numbering for steps.
``` | ||
$ terraform state show tidbcloud_dedicated_cluster.example_cluster | ||
|
||
# tidbcloud_cluster.example_cluster: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment in the example output refers to tidbcloud_cluster.example_cluster
. Since this document is about the dedicated cluster resource, it should be tidbcloud_dedicated_cluster.example_cluster
. Please check and correct this in all similar example outputs.
# tidbcloud_cluster.example_cluster: | |
# tidbcloud_dedicated_cluster.example_cluster: |
|
||
### Add a TiFlash component | ||
|
||
1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-cluster-using-the-cluster-resource), add the `tiflash_node_setting` configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The anchor #create-a-cluster-using-the-cluster-resource
appears to be from a different document. It should point to the relevant section within this document for creating a dedicated cluster. This issue also occurs on lines 571, 677, and 832.
A possible correct anchor would be #create-a-dedicated-cluster-using-the-dedicated-cluster-resource
.
1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-cluster-using-the-cluster-resource), add the `tiflash_node_setting` configuration. | |
1. In the `cluster.tf` file that is used when you [create the cluster](#create-a-dedicated-cluster-using-the-dedicated-cluster-resource), add the `tiflash_node_setting` configuration. |
|
||
## Delete a Dedicated cluster | ||
|
||
To delete a Dedicated cluster, you can delete the configuration of the `dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the resource name used elsewhere, this should be tidbcloud_dedicated_cluster
resource.
To delete a Dedicated cluster, you can delete the configuration of the `dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource: | |
To delete a Dedicated cluster, you can delete the configuration of the `tidbcloud_dedicated_cluster` resource, then use the `terraform apply` command to destroy the resource: |
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
|
||
## Prerequisites | ||
|
||
- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) at least v0.4.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) at least v0.4.0. | |
- [Get TiDB Cloud Terraform Provider](/tidb-cloud/terraform-get-tidbcloud-provider.md) v0.4.0 or later. |
Signed-off-by: FingerLeader <[email protected]>
Signed-off-by: FingerLeader <[email protected]>
this PR reopen in #21189 |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?